22 #ifndef __HERMES_COMMON_CS_MATRIX_H
23 #define __HERMES_COMMON_CS_MATRIX_H
34 template <
typename Scalar>
44 void create(
unsigned int size,
unsigned int nnz,
int* ap,
int* ai, Scalar* ax);
47 static int find_position(
int *Ai,
int Alen,
unsigned int idx);
58 void switch_orientation();
62 virtual void add(
unsigned int Ai_data_index,
unsigned int Ai_index, Scalar v);
66 virtual Scalar
get(
unsigned int Ai_data_index,
unsigned int Ai_index)
const;
71 virtual void alloc_data();
77 virtual void set_row_zero(
unsigned int n);
82 void export_to_file(
const char *filename,
const char *var_name,
MatrixExportFormat fmt,
char* number_format =
"%lf",
bool invert_storage =
false);
87 void import_from_file(
const char *filename,
const char *var_name,
MatrixExportFormat fmt,
bool invert_storage =
false);
90 virtual unsigned int get_nnz()
const;
92 virtual double get_fill_in()
const;
95 void multiply_with_Scalar(Scalar value);
105 Scalar *get_Ax()
const;
130 template <
typename Scalar>
144 virtual Scalar
get(
unsigned int m,
unsigned int n)
const;
146 virtual void add(
unsigned int m,
unsigned int n, Scalar v);
148 void multiply_with_vector(Scalar* vector_in, Scalar*& vector_out,
bool vector_out_initialized)
const;
150 virtual void export_to_file(
const char *filename,
const char *var_name,
MatrixExportFormat fmt,
char* number_format =
"%lf");
151 virtual void import_from_file(
const char *filename,
const char *var_name,
MatrixExportFormat fmt);
160 template <
typename Scalar>
174 virtual Scalar
get(
unsigned int m,
unsigned int n)
const;
176 virtual void add(
unsigned int m,
unsigned int n, Scalar v);
178 void export_to_file(
const char *filename,
const char *var_name,
MatrixExportFormat fmt,
char* number_format =
"%lf");
179 void import_from_file(
const char *filename,
const char *var_name,
MatrixExportFormat fmt);
190 virtual void pre_add_ij(
unsigned int row,
unsigned int col);
unsigned int nnz
Number of non-zero entries ( = Ap[size]).
General namespace for the Hermes library.
HERMES_API SparseMatrix< Scalar > * create_matrix(bool use_direct_solver=false)
Function returning a matrix according to the users's choice.
General CSR Matrix class. (can be used in umfpack, in that case use the CSCMatrix subclass...
int * Ap
Index to Ax/Ai, where each column / row starts.
General (abstract) sparse matrix representation in Hermes.
MatrixExportFormat
Format of file matrix and vector output.
General CSC Matrix class. (can be used in umfpack, in that case use the CSCMatrix subclass...
Basic matrix classes and operations.
int * Ai
Row / Column indices of values in Ax.
General CS Matrix class. Either row- or column- specific (see subclassses).