43 #ifndef CCOLMATRIX_HPP
44 #define CCOLMATRIX_HPP 1
84 void reallocate(
void );
85 void allocate(
void );
87 double get_check(
int i,
int j )
const;
88 double &set_check(
int i,
int j );
89 double get_no_check(
int i,
int j )
const;
90 double &set_no_check(
int i,
int j );
92 void clear_check(
int i,
int j );
93 void clear_no_check(
int i,
int j );
157 int rows(
void )
const {
return( _n ); }
161 void size(
int &n,
int &m )
const { n = _n; m = _m; }
179 void resize(
int n,
int m );
197 void clear(
int i,
int j );
226 double get(
int i,
int j )
const;
246 double &
set(
int i,
int j );
256 void set_column(
int j,
int N,
const int *row,
const double *val );
282 int &
ptr(
int i ) {
return( _ptr[i] ); }
287 int &
row(
int i ) {
return( _row[i] ); }
292 double &
val(
int i ) {
return( _val[i] ); }
297 const int &
ptr(
int i )
const {
return( _ptr[i] ); }
302 const int &
row(
int i )
const {
return( _row[i] ); }
307 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 );
void upper_diag_solve(Vector &x, const Vector &b) const
Solves A*x = b for upper diagonal matrix.
Compressed row sparse matrix class.
Definition: crowmatrix.hpp:76
const double & val(int i) const
Returns a const reference to the to the internal value data of the matrix.
Definition: ccolmatrix.hpp:307
const int & ptr(int i) const
Returns a const reference to the to the internal pointer index data ptr of the matrix.
Definition: ccolmatrix.hpp:297
int nz_elements(void) const
Returns the number of non-zero elements in the matrix.
Definition: ccolmatrix.hpp:165
int capacity(void) const
Returns the number of elements allocated for matrix.
Definition: ccolmatrix.hpp:169
Basis for matrix implementations.
Dense math vector class.
Definition: mvector.hpp:68
int columns(void) const
Returns the number of columns in the matrix.
Definition: ccolmatrix.hpp:153
void set_column(int j, int N, const int *row, const double *val)
Function to set matrix column elements.
int rows(void) const
Returns the number of rows in the matrix.
Definition: ccolmatrix.hpp:157
void construct_add(int i, int j, double val)
Adds an element to matrix while constructing the whole matrix.
void merge(CColMatrix &mat)
Merges matrix mat into the matrix leaving mat empty.
void clear(void)
Clear non-zero matrix elements, set all elements to zero.
int & ptr(int i)
Returns a reference to the to the internal pointer index data ptr of the matrix.
Definition: ccolmatrix.hpp:282
bool check_ascending(void)
Check if matrix data is in ascending row index order within each column.
void set_nz(int nz)
Set number of non-zero elements in the matrix.
void multiply_by_vector(Vector &x, const Vector &b) const
void debug_print(std::ostream &os) const
Print debugging information to os.
double & val(int i)
Returns a reference to the to the internal value data of the matrix.
Definition: ccolmatrix.hpp:292
void reserve(int size)
Reserve memory for size matrix elements.
const int & row(int i) const
Returns a const reference to the to the internal row data of the matrix.
Definition: ccolmatrix.hpp:302
void size(int &n, int &m) const
Returns the number of columns and number of columns in n and m.
Definition: ccolmatrix.hpp:161
CColMatrix & operator=(const CColMatrix &mat)
Assignment operator.
void lower_unit_solve(Vector &x, const Vector &b) const
Solves A*x = b for lower unit diagonal matrix.
Base matrix class.
Definition: matrix.hpp:76
int & row(int i)
Returns a reference to the to the internal column data of the matrix.
Definition: ccolmatrix.hpp:287
Error classes and handling
double & set(int i, int j)
Function to get a reference to matrix element value at (i,j).
Definition: ccolmatrix.hpp:385
double get(int i, int j) const
Function to get a matrix element value at (i,j).
Definition: ccolmatrix.hpp:375
Harwell Boeing sparse matrix file format I/O class.
Definition: hbio.hpp:66
void order_ascending(void)
Order (sort) matrix data in ascending row index order within each column.
Compressed column sparse matrix class.
Definition: ccolmatrix.hpp:75
CColMatrix()
Default constructor.
void resize(int n, int m)
Resizes the matrix to size n x m.
Coordinate sparse matrix class.
Definition: coordmatrix.hpp:72