harwell_boeing.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #ifndef IGL_HARWELL_BOEING_H
  2. #define IGL_HARWELL_BOEING_H
  3. #include "igl_inline.h"
  4. #define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET
  5. #include <Eigen/Sparse>
  6. #include <vector>
  7. namespace igl
  8. {
  9. // Convert the matrix to Compressed sparse column (CSC or CCS) format,
  10. // also known as Harwell Boeing format. As described:
  11. // http://netlib.org/linalg/html_templates/node92.html
  12. // or
  13. // http://en.wikipedia.org/wiki/Sparse_matrix
  14. // #Compressed_sparse_column_.28CSC_or_CCS.29
  15. // Templates:
  16. // Scalar type of sparse matrix like double
  17. // Inputs:
  18. // A sparse m by n matrix
  19. // Outputs:
  20. // num_rows number of rows
  21. // V non-zero values, row indices running fastest, size(V) = nnz
  22. // R row indices corresponding to vals, size(R) = nnz
  23. // C index in vals of first entry in each column, size(C) = num_cols+1
  24. //
  25. // All indices and pointers are 0-based
  26. template <typename Scalar, typename Index>
  27. IGL_INLINE void harwell_boeing(
  28. const Eigen::SparseMatrix<Scalar> & A,
  29. int & num_rows,
  30. std::vector<Scalar> & V,
  31. std::vector<Index> & R,
  32. std::vector<Index> & C);
  33. }
  34. #ifdef IGL_HEADER_ONLY
  35. # include "harwell_boeing.cpp"
  36. #endif
  37. #endif