43 #ifndef CROWMATRIX_HPP
44 #define CROWMATRIX_HPP 1
85 void reallocate(
void );
86 void allocate(
void );
88 double get_check(
int i,
int j )
const;
89 double &set_check(
int i,
int j );
90 double get_no_check(
int i,
int j )
const;
91 double &set_no_check(
int i,
int j );
93 void clear_check(
int i,
int j );
94 void clear_no_check(
int i,
int j );
158 int rows(
void )
const {
return( _n ); }
163 void size(
int &n,
int &m )
const { n = _n; m = _m; }
181 void resize(
int n,
int m );
199 void clear(
int i,
int j );
228 double get(
int i,
int j )
const;
248 double &
set(
int i,
int j );
258 void set_row(
int i,
int N,
const int *col,
const double *val );
284 int &
ptr(
int i ) {
return( _ptr[i] ); }
289 int &
col(
int i ) {
return( _col[i] ); }
294 double &
val(
int i ) {
return( _val[i] ); }
299 const int &
ptr(
int i )
const {
return( _ptr[i] ); }
304 const int &
col(
int i )
const {
return( _col[i] ); }
309 const double &
val(
int i )
const {
return( _val[i] ); }
377 #ifdef SPM_RANGE_CHECK
378 return( get_check( i, j ) );
380 return( get_no_check( i, j ) );
387 #ifdef SPM_RANGE_CHECK
388 return( set_check( i, j ) );
390 return( set_no_check( i, j ) );
397 #ifdef SPM_RANGE_CHECK
400 clear_no_check( i, j );
Compressed row sparse matrix class.
Definition: crowmatrix.hpp:76
void upper_diag_solve(Vector &x, const Vector &b) const
Solves A*x = b for upper diagonal matrix.
int columns(void) const
Returns the number of columns in the matrix.
Definition: crowmatrix.hpp:154
Basis for matrix implementations.
void size(int &n, int &m) const
Returns the number of columns and number of columns in nn and mm.
Definition: crowmatrix.hpp:163
const int & ptr(int i) const
Returns a const reference to the to the internal pointer index data ptr of the matrix.
Definition: crowmatrix.hpp:299
void multiply_by_vector(Vector &x, const Vector &b) const
Dense math vector class.
Definition: mvector.hpp:68
int rows(void) const
Returns the number of rows in the matrix.
Definition: crowmatrix.hpp:158
void resize(int n, int m)
Resizes the matrix to size n x m.
void order_ascending(void)
Order (sort) matrix data in ascending column index order within each row.
void construct_add(int i, int j, double val)
Adds an element to matrix while constructing the whole matrix.
CRowMatrix()
Default constructor.
CRowMatrix & operator=(const CRowMatrix &mat)
Assignment operator.
const double & val(int i) const
Returns a const reference to the to the internal value data of the matrix.
Definition: crowmatrix.hpp:309
void set_row(int i, int N, const int *col, const double *val)
Function to set matrix row elements.
int & col(int i)
Returns a reference to the to the internal column data of the matrix.
Definition: crowmatrix.hpp:289
int & ptr(int i)
Returns a reference to the to the internal pointer index data ptr of the matrix.
Definition: crowmatrix.hpp:284
double & set(int i, int j)
Function to get a reference to matrix element value at (i,j).
Definition: crowmatrix.hpp:385
double & val(int i)
Returns a reference to the to the internal value data of the matrix.
Definition: crowmatrix.hpp:294
int capacity(void) const
Returns the number of elements allocated for matrix.
Definition: crowmatrix.hpp:171
Base matrix class.
Definition: matrix.hpp:76
void reserve(int size)
Reserve memory for size matrix elements.
void set_nz(int nz)
Set number of non-zero elements in the matrix.
Error classes and handling
void clear(void)
Clear non-zero matrix elements, set all elements to zero.
bool check_ascending(void)
Check if matrix data is in ascending column index order within each row.
void merge(CRowMatrix &mat)
Merges matrix mat into the matrix leaving mat empty.
int nz_elements(void) const
Returns the number of non-zero elements in the matrix.
Definition: crowmatrix.hpp:167
void lower_unit_solve(Vector &x, const Vector &b) const
Solves A*x = b for lower unit diagonal matrix.
double get(int i, int j) const
Function to get a matrix element value at (i,j).
Definition: crowmatrix.hpp:375
const int & col(int i) const
Returns a const reference to the to the internal column data of the matrix.
Definition: crowmatrix.hpp:304
Compressed column sparse matrix class.
Definition: ccolmatrix.hpp:75
void debug_print(std::ostream &os) const
Print debugging information to os.
Coordinate sparse matrix class.
Definition: coordmatrix.hpp:72