AbstractLinAlgPack: C++ Interfaces For Vectors, Matrices And Related Linear Algebra Objects
Version of the Day
|
Coordinate matrix subclass. More...
#include <AbstractLinAlgPack_MatrixSparseCOORSerial.hpp>
Classes | |
class | ReleaseValRowColArrays |
Subclass to delete dynamically allocated memory with delete []. More... | |
Public types | |
typedef Teuchos::RCP < MemMngPack::ReleaseResource > | release_resource_ptr_t |
Constructors / initializers | |
MatrixSparseCOORSerial () | |
Let this allocate its own memory. More... | |
void | set_buffers (size_type max_nz, value_type *val, index_type *row_i, index_type *col_j, const release_resource_ptr_t &release_resource, size_type rows=0, size_type cols=0, size_type nz=0, bool check_input=false) |
Give memory to use to store nonzero elements. More... | |
void | set_uninitialized () |
Release all owned memory and make uninitialized. More... | |
Access | |
value_type * | val () |
const value_type * | val () const |
index_type * | row_i () |
const index_type * | row_i () const |
index_type * | col_j () |
const index_type * | col_j () const |
const release_resource_ptr_t & | release_resource () const |
Overridden from MatrixBase | |
size_type | rows () const |
size_type | cols () const |
size_type | nz () const |
Overridden from MatrixOp | |
const VectorSpace & | space_cols () const |
const VectorSpace & | space_rows () const |
MatrixOp & | operator= (const MatrixOp &M) |
std::ostream & | output (std::ostream &out) const |
void | Vp_StMtV (VectorMutable *vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2, value_type beta) const |
Overridden from MatrixLoadSparseElements | |
void | reinitialize (size_type rows, size_type cols, size_type max_nz, EAssumeElementUniqueness element_uniqueness) |
void | reset_to_load_values () |
Reinitialize internal counter to load new nonzero values. More... | |
void | get_load_nonzeros_buffers (size_type max_nz_load, value_type **val, index_type **row_i, index_type **col_j) |
void | commit_load_nonzeros_buffers (size_type nz_commit, value_type **val, index_type **row_i, index_type **col_j) |
void | finish_construction (bool test_setup) |
Overridden from MatrixExtractSparseElements | |
index_type | count_nonzeros (EElementUniqueness element_uniqueness, const index_type inv_row_perm[], const index_type inv_col_perm[], const Range1D &row_rng, const Range1D &col_rng, index_type dl, index_type du) const |
void | coor_extract_nonzeros (EElementUniqueness element_uniqueness, const index_type inv_row_perm[], const index_type inv_col_perm[], const Range1D &row_rng, const Range1D &col_rng, index_type dl, index_type du, value_type alpha, const index_type len_Aval, value_type Aval[], const index_type len_Aij, index_type Arow[], index_type Acol[], const index_type row_offset, const index_type col_offset) const |
Additional Inherited Members | |
Public Types inherited from AbstractLinAlgPack::MatrixOp | |
enum | EMatNormType { MAT_NORM_INF, MAT_NORM_2, MAT_NORM_1, MAT_NORM_FORB } |
Type of matrix norm. More... | |
Public Types inherited from AbstractLinAlgPack::MatrixLoadSparseElements | |
enum | EAssumeElementUniqueness { ELEMENTS_ASSUME_UNIQUE, ELEMENTS_ASSUME_DUPLICATES_SUM } |
Public Types inherited from AbstractLinAlgPack::MatrixConvertToSparse | |
enum | EExtractRegion { EXTRACT_FULL_MATRIX, EXTRACT_UPPER_TRIANGULAR, EXTRACT_LOWER_TRIANGULAR } |
enum | EElementUniqueness { ELEMENTS_FORCE_UNIQUE, ELEMENTS_ALLOW_DUPLICATES_SUM } |
Public Member Functions inherited from AbstractLinAlgPack::MatrixOp | |
virtual void | zero_out () |
M_lhs = 0 : Zero out the matrix. More... | |
virtual void | Mt_S (value_type alpha) |
M_lhs *= alpha : Multiply a matrix by a scalar. More... | |
virtual mat_mut_ptr_t | clone () |
Clone the non-const matrix object (if supported). More... | |
virtual mat_ptr_t | clone () const |
Clone the const matrix object (if supported). More... | |
const MatNorm | calc_norm (EMatNormType requested_norm_type=MAT_NORM_1, bool allow_replacement=false) const |
Compute a norm of this matrix. More... | |
virtual mat_ptr_t | sub_view (const Range1D &row_rng, const Range1D &col_rng) const |
Create a transient constant sub-matrix view of this matrix (if supported). More... | |
mat_ptr_t | sub_view (const index_type &rl, const index_type &ru, const index_type &cl, const index_type &cu) const |
Inlined implementation calls this->sub_view(Range1D(rl,ru),Range1D(cl,cu)) . More... | |
virtual mat_ptr_t | perm_view (const Permutation *P_row, const index_type row_part[], int num_row_part, const Permutation *P_col, const index_type col_part[], int num_col_part) const |
Create a permuted view: M_perm = P_row' * M * P_col . More... | |
virtual mat_ptr_t | perm_view_update (const Permutation *P_row, const index_type row_part[], int num_row_part, const Permutation *P_col, const index_type col_part[], int num_col_part, const mat_ptr_t &perm_view) const |
Reinitialize a permuted view: M_perm = P_row' * M * P_col . More... | |
Public Member Functions inherited from AbstractLinAlgPack::MatrixBase | |
virtual | ~MatrixBase () |
Virtual destructor. More... | |
Public Member Functions inherited from AbstractLinAlgPack::MatrixExtractSparseElements | |
index_type | num_nonzeros (EExtractRegion extract_region, EElementUniqueness element_uniqueness) const |
void | coor_extract_nonzeros (EExtractRegion extract_region, EElementUniqueness element_uniqueness, const index_type len_Aval, value_type Aval[], const index_type len_Aij, index_type Arow[], index_type Acol[], const index_type row_offset, const index_type col_offset) const |
Protected Member Functions inherited from AbstractLinAlgPack::MatrixOp | |
virtual bool | Mp_StM (MatrixOp *mwo_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs) const |
mwo_lhs += alpha * op(M_rhs) (BLAS xAXPY). More... | |
virtual bool | Mp_StM (value_type alpha, const MatrixOp &M_rhs, BLAS_Cpp::Transp trans_rhs) |
M_lhs += alpha * op(mwo_rhs) (BLAS xAXPY). More... | |
virtual bool | Mp_StMtP (MatrixOp *mwo_lhs, value_type alpha, BLAS_Cpp::Transp M_trans, const GenPermMatrixSlice &P_rhs, BLAS_Cpp::Transp P_rhs_trans) const |
mwo_lhs += alpha * op(M_rhs) * op(P_rhs). More... | |
virtual bool | Mp_StMtP (value_type alpha, const MatrixOp &mwo_rhs, BLAS_Cpp::Transp M_trans, const GenPermMatrixSlice &P_rhs, BLAS_Cpp::Transp P_rhs_trans) |
M_lhs += alpha * op(mwo_rhs) * op(P_rhs). More... | |
virtual bool | Mp_StPtM (MatrixOp *mwo_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs, BLAS_Cpp::Transp P_rhs_trans, BLAS_Cpp::Transp M_trans) const |
mwo_lhs += alpha * op(P_rhs) * op(M_rhs). More... | |
virtual bool | Mp_StPtM (value_type alpha, const GenPermMatrixSlice &P_rhs, BLAS_Cpp::Transp P_rhs_trans, const MatrixOp &mwo_rhs, BLAS_Cpp::Transp M_trans) |
M_lhs += alpha * op(P_rhs) * op(mwo_rhs). More... | |
virtual bool | Mp_StPtMtP (MatrixOp *mwo_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs1, BLAS_Cpp::Transp P_rhs1_trans, BLAS_Cpp::Transp M_trans, const GenPermMatrixSlice &P_rhs2, BLAS_Cpp::Transp P_rhs2_trans) const |
mwo_lhs += alpha * op(P_rhs1) * op(M_rhs) * op(P_rhs2). More... | |
virtual bool | Mp_StPtMtP (value_type alpha, const GenPermMatrixSlice &P_rhs1, BLAS_Cpp::Transp P_rhs1_trans, const MatrixOp &mwo_rhs, BLAS_Cpp::Transp M_trans, const GenPermMatrixSlice &P_rhs2, BLAS_Cpp::Transp P_rhs2_trans) |
M_lhs += alpha * op(P_rhs1) * op(mwo_rhs) * op(P_rhs2). More... | |
virtual void | Vp_StMtV (VectorMutable *v_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1, const SpVectorSlice &sv_rhs2, value_type beta) const |
v_lhs = alpha * op(M_rhs1) * sv_rhs2 + beta * v_lhs (BLAS xGEMV) More... | |
virtual void | Vp_StPtMtV (VectorMutable *v_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs1, BLAS_Cpp::Transp P_rhs1_trans, BLAS_Cpp::Transp M_rhs2_trans, const Vector &v_rhs3, value_type beta) const |
v_lhs = alpha * op(P_rhs1) * op(M_rhs2) * v_rhs3 + beta * v_rhs More... | |
virtual void | Vp_StPtMtV (VectorMutable *v_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs1, BLAS_Cpp::Transp P_rhs1_trans, BLAS_Cpp::Transp M_rhs2_trans, const SpVectorSlice &sv_rhs3, value_type beta) const |
v_lhs = alpha * op(P_rhs1) * op(M_rhs2) * sv_rhs3 + beta * v_rhs More... | |
virtual value_type | transVtMtV (const Vector &v_rhs1, BLAS_Cpp::Transp trans_rhs2, const Vector &v_rhs3) const |
result = v_rhs1' * op(M_rhs2) * v_rhs3 More... | |
virtual value_type | transVtMtV (const SpVectorSlice &sv_rhs1, BLAS_Cpp::Transp trans_rhs2, const SpVectorSlice &sv_rhs3) const |
result = sv_rhs1' * op(M_rhs2) * sv_rhs3 More... | |
virtual void | syr2k (BLAS_Cpp::Transp M_trans, value_type alpha, const GenPermMatrixSlice &P1, BLAS_Cpp::Transp P1_trans, const GenPermMatrixSlice &P2, BLAS_Cpp::Transp P2_trans, value_type beta, MatrixSymOp *symwo_lhs) const |
Perform a specialized rank-2k update of a dense symmetric matrix of the form: More... | |
virtual bool | Mp_StMtM (MatrixOp *mwo_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1, const MatrixOp &mwo_rhs2, BLAS_Cpp::Transp trans_rhs2, value_type beta) const |
mwo_lhs = alpha * op(M_rhs1) * op(mwo_rhs2) + beta * mwo_lhs (left) (xGEMM). More... | |
virtual bool | Mp_StMtM (MatrixOp *mwo_lhs, value_type alpha, const MatrixOp &mwo_rhs1, BLAS_Cpp::Transp trans_rhs1, BLAS_Cpp::Transp trans_rhs2, value_type beta) const |
mwo_lhs = alpha * op(mwo_rhs1) * op(M_rhs2) + beta * mwo_lhs (right) (xGEMM) More... | |
virtual bool | Mp_StMtM (value_type alpha, const MatrixOp &mwo_rhs1, BLAS_Cpp::Transp trans_rhs1, const MatrixOp &mwo_rhs2, BLAS_Cpp::Transp trans_rhs2, value_type beta) |
M_lhs = alpha * op(mwo_rhs1) * op(mwo_rhs2) + beta * mwo_lhs (left) (xGEMM) More... | |
virtual bool | syrk (BLAS_Cpp::Transp M_trans, value_type alpha, value_type beta, MatrixSymOp *sym_lhs) const |
Perform a rank-k update of a symmetric matrix of the form: More... | |
virtual bool | syrk (const MatrixOp &mwo_rhs, BLAS_Cpp::Transp M_trans, value_type alpha, value_type beta) |
Perform a rank-k update of a symmetric matrix of the form: More... | |
Coordinate matrix subclass.
ToDo: Finish documentation!
Definition at line 57 of file AbstractLinAlgPack_MatrixSparseCOORSerial.hpp.
typedef Teuchos::RCP< MemMngPack::ReleaseResource> AbstractLinAlgPack::MatrixSparseCOORSerial::release_resource_ptr_t |
Definition at line 69 of file AbstractLinAlgPack_MatrixSparseCOORSerial.hpp.
AbstractLinAlgPack::MatrixSparseCOORSerial::MatrixSparseCOORSerial | ( | ) |
Let this
allocate its own memory.
Definition at line 76 of file AbstractLinAlgPack_MatrixSparseCOORSerial.cpp.
void AbstractLinAlgPack::MatrixSparseCOORSerial::set_buffers | ( | size_type | max_nz, |
value_type * | val, | ||
index_type * | row_i, | ||
index_type * | col_j, | ||
const release_resource_ptr_t & | release_resource, | ||
size_type | rows = 0 , |
||
size_type | cols = 0 , |
||
size_type | nz = 0 , |
||
bool | check_input = false |
||
) |
Give memory to use to store nonzero elements.
max_nz | [in] Size of the buffers val [], row_i [] and col_j []. It is allowed for max_nz == 0 in which case this matrix will not have any nonzero elements (i.e. the zero matrix). |
val | [in] Buffer to store the nonzero entry values. On input val[k], for k = 0...nz-1 must be set to valid nonzero entry values if rows > 0 && nz > 0 . |
row_i | [in] Buffer to store the nonzero entry row indexes. On input row_i[k], for k = 0...nz-1 must be set to valid nonzero entry row indexes if rows > 0 && nz > 0 . |
col_j | [in] Buffer to store the nonzero entry row indexes. On input col_j[k], for k = 0...nz-1 must be set to valid nonzero entry row indexes if rows > 0 && nz > 0 . |
release_resource | [in] Smart pointer to a MemMngPack::ReleaseResouce object that will deallocate the memory for the buffers val [], row_i [] and col_j [] when this is finished with them. It is allowed for release_resource.get() == NULL in which case the client will be responsible to free this memory. The client can use the subclass ReleaseValRowColArrays to allow this to delete memory created with new [] by setting release_resource = Teuchos::rcp( new ReleaseValRowColArrays(val,row_i,col_j) ) where val , row_i and col_j where allocated with new []. The release_resource object represents the sharing of the data val [], row_i [] and col_j []. |
rows | [in] Number of rows in the matrix. Default = 0 for fully uninitialized. |
cols | [in] Number of columns in the matrix. Ignored if rows == 0 . |
nz | [in] Number of nonzero elements in val [], row_i [] and col_j [] already set. Setting a value of nz > 0 allows the client to setup a matrix object with nonzero elements ready to go. Ignored if rows == 0 . |
check_input | [in] If true and rows > 0 && nz > 0 then the row and colunmn indexes in row_i [] and col_j [] will be checked! The defualt is false . |
Preconditions:
max_nz > 0
(throw std::invalid_argument
) val != NULL
(throw std::invalid_argument
) row_i != NULL
(throw std::invalid_argument
) col_j != NULL
(throw std::invalid_argument
) rows >= 0
(throw std::invalid_argument
) rows > 0
] cols > 0
(throw std::invalid_argument
) rows > 0
] 0 <= nz <= max_nz
(throw std::invalid_argument
) nz > 0
] 1 <= row_i[k] <= rows, for k = 0...nz-1
(throw std::invalid_argument) nz > 0
] 1 <= col_j[k] <= cols, for k = 0...nz-1
(throw std::invalid_argument) Postconditions:
this->release_resource().get() == release_resource
rows > 0
] this->rows() == rows
rows > 0
] this->cols() == cols
rows > 0
] this->nz() == nz
Definition at line 87 of file AbstractLinAlgPack_MatrixSparseCOORSerial.cpp.
void AbstractLinAlgPack::MatrixSparseCOORSerial::set_uninitialized | ( | ) |
Release all owned memory and make uninitialized.
Postconditions:
this->reinitialize(rows,cols,max_nz)
this
will allocate its own memory. Definition at line 131 of file AbstractLinAlgPack_MatrixSparseCOORSerial.cpp.
|
inline |
Definition at line 349 of file AbstractLinAlgPack_MatrixSparseCOORSerial.hpp.
|
inline |
Definition at line 356 of file AbstractLinAlgPack_MatrixSparseCOORSerial.hpp.
|
inline |
Definition at line 362 of file AbstractLinAlgPack_MatrixSparseCOORSerial.hpp.
|
inline |
Definition at line 369 of file AbstractLinAlgPack_MatrixSparseCOORSerial.hpp.
|
inline |
Definition at line 375 of file AbstractLinAlgPack_MatrixSparseCOORSerial.hpp.
|
inline |
Definition at line 382 of file AbstractLinAlgPack_MatrixSparseCOORSerial.hpp.
|
inline |
Definition at line 389 of file AbstractLinAlgPack_MatrixSparseCOORSerial.hpp.
|
virtual |
Reimplemented from AbstractLinAlgPack::MatrixBase.
Definition at line 148 of file AbstractLinAlgPack_MatrixSparseCOORSerial.cpp.
|
virtual |
Reimplemented from AbstractLinAlgPack::MatrixBase.
Definition at line 153 of file AbstractLinAlgPack_MatrixSparseCOORSerial.cpp.
|
virtual |
Reimplemented from AbstractLinAlgPack::MatrixBase.
Definition at line 158 of file AbstractLinAlgPack_MatrixSparseCOORSerial.cpp.
|
virtual |
Implements AbstractLinAlgPack::MatrixBase.
Definition at line 165 of file AbstractLinAlgPack_MatrixSparseCOORSerial.cpp.
|
virtual |
Implements AbstractLinAlgPack::MatrixBase.
Definition at line 170 of file AbstractLinAlgPack_MatrixSparseCOORSerial.cpp.
Reimplemented from AbstractLinAlgPack::MatrixOp.
Definition at line 175 of file AbstractLinAlgPack_MatrixSparseCOORSerial.cpp.
|
virtual |
Reimplemented from AbstractLinAlgPack::MatrixOp.
Definition at line 197 of file AbstractLinAlgPack_MatrixSparseCOORSerial.cpp.
|
virtual |
Implements AbstractLinAlgPack::MatrixOp.
Definition at line 224 of file AbstractLinAlgPack_MatrixSparseCOORSerial.cpp.
|
virtual |
Implements AbstractLinAlgPack::MatrixLoadSparseElements.
Definition at line 242 of file AbstractLinAlgPack_MatrixSparseCOORSerial.cpp.
|
virtual |
Reinitialize internal counter to load new nonzero values.
The row and column index arrays are preserved from the last setup and here the client only wants to set the nonzero values for the same matrix structure.
ToDo: Finish documentation!
Implements AbstractLinAlgPack::MatrixLoadSparseElements.
Definition at line 286 of file AbstractLinAlgPack_MatrixSparseCOORSerial.cpp.
|
virtual |
Implements AbstractLinAlgPack::MatrixLoadSparseElements.
Definition at line 301 of file AbstractLinAlgPack_MatrixSparseCOORSerial.cpp.
|
virtual |
Implements AbstractLinAlgPack::MatrixLoadSparseElements.
Definition at line 337 of file AbstractLinAlgPack_MatrixSparseCOORSerial.cpp.
|
virtual |
Implements AbstractLinAlgPack::MatrixLoadSparseElements.
Definition at line 369 of file AbstractLinAlgPack_MatrixSparseCOORSerial.cpp.
|
virtual |
Implements AbstractLinAlgPack::MatrixExtractSparseElements.
Definition at line 409 of file AbstractLinAlgPack_MatrixSparseCOORSerial.cpp.
|
virtual |
Implements AbstractLinAlgPack::MatrixExtractSparseElements.
Definition at line 495 of file AbstractLinAlgPack_MatrixSparseCOORSerial.cpp.