MOOCHO (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
AbstractLinAlgPack::MatrixSparseCOORSerial Class Reference

Coordinate matrix subclass. More...

#include <AbstractLinAlgPack_MatrixSparseCOORSerial.hpp>

Inheritance diagram for AbstractLinAlgPack::MatrixSparseCOORSerial:
Inheritance graph
[legend]

Classes

class  ReleaseValRowColArrays
 Subclass to delete dynamically allocated memory with delete[]. More...
 

Private Member Functions

void make_storage_unique ()
 

Private Attributes

size_type rows_
 
size_type cols_
 
size_type max_nz_
 
EAssumeElementUniqueness element_uniqueness_
 
size_type nz_
 
value_typeval_
 
index_typerow_i_
 
index_typecol_j_
 
release_resource_ptr_t release_resource_
 
bool self_allocate_
 
VectorSpaceSerial space_cols_
 
VectorSpaceSerial space_rows_
 
size_type max_nz_load_
 
bool reload_val_only_
 
size_type reload_val_only_nz_last_
 

Static Private Attributes

static release_resource_ptr_t release_resource_null_ = Teuchos::null
 

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_typeval ()
 
const value_typeval () const
 
index_typerow_i ()
 
const index_typerow_i () const
 
index_typecol_j ()
 
const index_typecol_j () const
 
const release_resource_ptr_trelease_resource () const
 

Overridden from MatrixBase

size_type rows () const
 
size_type cols () const
 
size_type nz () const
 

Overridden from MatrixOp

const VectorSpacespace_cols () const
 
const VectorSpacespace_rows () const
 
MatrixOpoperator= (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...
 

Detailed Description

Coordinate matrix subclass.

ToDo: Finish documentation!

Definition at line 57 of file AbstractLinAlgPack_MatrixSparseCOORSerial.hpp.

Member Typedef Documentation

Constructor & Destructor Documentation

AbstractLinAlgPack::MatrixSparseCOORSerial::MatrixSparseCOORSerial ( )

Let this allocate its own memory.

Definition at line 76 of file AbstractLinAlgPack_MatrixSparseCOORSerial.cpp.

Member Function Documentation

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.

Parameters
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:

Definition at line 87 of file AbstractLinAlgPack_MatrixSparseCOORSerial.cpp.

void AbstractLinAlgPack::MatrixSparseCOORSerial::set_uninitialized ( )

Release all owned memory and make uninitialized.

Postconditions:

  • On the next call to this->reinitialize(rows,cols,max_nz) this will allocate its own memory.

Definition at line 131 of file AbstractLinAlgPack_MatrixSparseCOORSerial.cpp.

value_type * AbstractLinAlgPack::MatrixSparseCOORSerial::val ( )
inline
const value_type * AbstractLinAlgPack::MatrixSparseCOORSerial::val ( ) const
inline
index_type * AbstractLinAlgPack::MatrixSparseCOORSerial::row_i ( )
inline
const index_type * AbstractLinAlgPack::MatrixSparseCOORSerial::row_i ( ) const
inline
index_type * AbstractLinAlgPack::MatrixSparseCOORSerial::col_j ( )
inline
const index_type * AbstractLinAlgPack::MatrixSparseCOORSerial::col_j ( ) const
inline
const MatrixSparseCOORSerial::release_resource_ptr_t & AbstractLinAlgPack::MatrixSparseCOORSerial::release_resource ( ) const
inline
size_type AbstractLinAlgPack::MatrixSparseCOORSerial::rows ( ) const
virtual

Reimplemented from AbstractLinAlgPack::MatrixBase.

Definition at line 148 of file AbstractLinAlgPack_MatrixSparseCOORSerial.cpp.

size_type AbstractLinAlgPack::MatrixSparseCOORSerial::cols ( ) const
virtual

Reimplemented from AbstractLinAlgPack::MatrixBase.

Definition at line 153 of file AbstractLinAlgPack_MatrixSparseCOORSerial.cpp.

size_type AbstractLinAlgPack::MatrixSparseCOORSerial::nz ( ) const
virtual

Reimplemented from AbstractLinAlgPack::MatrixBase.

Definition at line 158 of file AbstractLinAlgPack_MatrixSparseCOORSerial.cpp.

const VectorSpace & AbstractLinAlgPack::MatrixSparseCOORSerial::space_cols ( ) const
virtual
const VectorSpace & AbstractLinAlgPack::MatrixSparseCOORSerial::space_rows ( ) const
virtual
MatrixOp & AbstractLinAlgPack::MatrixSparseCOORSerial::operator= ( const MatrixOp M)
virtual

Reimplemented from AbstractLinAlgPack::MatrixOp.

Definition at line 175 of file AbstractLinAlgPack_MatrixSparseCOORSerial.cpp.

std::ostream & AbstractLinAlgPack::MatrixSparseCOORSerial::output ( std::ostream &  out) const
virtual

Reimplemented from AbstractLinAlgPack::MatrixOp.

Definition at line 197 of file AbstractLinAlgPack_MatrixSparseCOORSerial.cpp.

void AbstractLinAlgPack::MatrixSparseCOORSerial::Vp_StMtV ( VectorMutable vs_lhs,
value_type  alpha,
BLAS_Cpp::Transp  trans_rhs1,
const Vector v_rhs2,
value_type  beta 
) const
virtual
void AbstractLinAlgPack::MatrixSparseCOORSerial::reinitialize ( size_type  rows,
size_type  cols,
size_type  max_nz,
EAssumeElementUniqueness  element_uniqueness 
)
virtual
void AbstractLinAlgPack::MatrixSparseCOORSerial::reset_to_load_values ( )
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.

void AbstractLinAlgPack::MatrixSparseCOORSerial::get_load_nonzeros_buffers ( size_type  max_nz_load,
value_type **  val,
index_type **  row_i,
index_type **  col_j 
)
virtual
void AbstractLinAlgPack::MatrixSparseCOORSerial::commit_load_nonzeros_buffers ( size_type  nz_commit,
value_type **  val,
index_type **  row_i,
index_type **  col_j 
)
virtual
void AbstractLinAlgPack::MatrixSparseCOORSerial::finish_construction ( bool  test_setup)
virtual
index_type AbstractLinAlgPack::MatrixSparseCOORSerial::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
virtual
void AbstractLinAlgPack::MatrixSparseCOORSerial::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
virtual
void AbstractLinAlgPack::MatrixSparseCOORSerial::make_storage_unique ( )
private

Member Data Documentation

size_type AbstractLinAlgPack::MatrixSparseCOORSerial::rows_
private
size_type AbstractLinAlgPack::MatrixSparseCOORSerial::cols_
private
size_type AbstractLinAlgPack::MatrixSparseCOORSerial::max_nz_
private
EAssumeElementUniqueness AbstractLinAlgPack::MatrixSparseCOORSerial::element_uniqueness_
private
size_type AbstractLinAlgPack::MatrixSparseCOORSerial::nz_
private
value_type* AbstractLinAlgPack::MatrixSparseCOORSerial::val_
private
index_type* AbstractLinAlgPack::MatrixSparseCOORSerial::row_i_
private
index_type* AbstractLinAlgPack::MatrixSparseCOORSerial::col_j_
private
release_resource_ptr_t AbstractLinAlgPack::MatrixSparseCOORSerial::release_resource_
private
bool AbstractLinAlgPack::MatrixSparseCOORSerial::self_allocate_
private
VectorSpaceSerial AbstractLinAlgPack::MatrixSparseCOORSerial::space_cols_
private
VectorSpaceSerial AbstractLinAlgPack::MatrixSparseCOORSerial::space_rows_
private
size_type AbstractLinAlgPack::MatrixSparseCOORSerial::max_nz_load_
private
bool AbstractLinAlgPack::MatrixSparseCOORSerial::reload_val_only_
private
size_type AbstractLinAlgPack::MatrixSparseCOORSerial::reload_val_only_nz_last_
private
MatrixSparseCOORSerial::release_resource_ptr_t AbstractLinAlgPack::MatrixSparseCOORSerial::release_resource_null_ = Teuchos::null
staticprivate

The documentation for this class was generated from the following files: