63 T my_min(
const T& v1,
const T& v2 ) {
return v1 < v2 ? v1 : v2; }
66 namespace AbstractLinAlgPack {
69 : num_updates_at_once_(0)
83 out <<
"*** Sparse diagonal matrix ***\n"
84 <<
"diag =\n" <<
diag();
110 (*vs_lhs)(i) = beta * (*vs_lhs)(i) + alpha * d_itr->value() * vs_rhs2(i);
204 = my_min( num_updates_at_once()
205 ? num_updates_at_once()
212 num_blocks = diag.
nz() / num_updates;
213 if( diag.
nz() % num_updates > 0 )
222 for(
size_type k = 1; k <= num_blocks; ++k ) {
224 i1 = (k-1) * num_updates + 1,
225 i2 = my_min( diag.
nz(), i1 + num_updates - 1 );
228 m_itr = diag.
begin() + (i1-1);
229 for(
size_type l = 1; l <= i2-i1+1; ++l, ++m_itr ) {
236 D_update = D(1,m,1,i2-i1+1);
274 (len_Aval != 0 ? len_Aval != diag.
nz() : Aval != NULL)
275 ,std::invalid_argument
276 ,
"MatrixSymDiagSparse::coor_extract_nonzeros(...): Error!" );
278 (len_Aij != 0 ? len_Aij != diag.
nz() : (Acol != NULL || Acol != NULL) )
279 ,std::invalid_argument
280 ,
"MatrixSymDiagSparse::coor_extract_nonzeros(...): Error!" );
287 for( itr = diag.
begin(), l_Aval = Aval; itr != diag.
end(); ++itr ) {
288 *l_Aval++ = itr->
value();
296 for( itr = diag.
begin(), l_Arow = Arow, l_Acol = Acol; itr != diag.
end(); ++itr ) {
299 *l_Arow++ = ij + row_offset;
300 *l_Acol++ = ij + col_offset;
difference_type offset() const
Return the offset for the indexes (ith real index = begin()[i-1]->index() + offset()# ...
RTOp_index_type index_type
size_type dim() const
Returns the number of elements of the VectorSliceTmpl.
size_type dim() const
Return the number of elements in the full vector.
void assign(DMatrix *gm_lhs, value_type alpha)
gm_lhs = alpha (elementwise)
virtual const SpVectorSlice diag() const =0
Give access to the sparse diagonal.
RTOp_value_type value_type
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
size_type rows(size_type rows, size_type cols, BLAS_Cpp::Transp _trans)
Return rows of a possible transposed matrix.
const LAPACK_C_Decl::f_int LAPACK_C_Decl::f_dbl_prec * A
bool assert_print_nan_inf(const value_type &val, const std::string &name, bool throw_excpt, std::ostream *out)
BLAS_Cpp::Uplo uplo() const
void syrk(BLAS_Cpp::Transp trans, value_type alpha, const DMatrixSlice &gms_rhs, value_type beta, DMatrixSliceSym *sym_lhs)
Base class for all matrices implemented in a shared memory address space.
void Vp_V_assert_sizes(size_type v_lhs_size, size_type v_rhs_size)
v_lhs += op v_rhs
const index_type & index() const
virtual size_type cols() const
Return the number of columns in the matrix.
RTOp_index_type size_type
virtual void syrk(BLAS_Cpp::Transp M_trans, value_type alpha, value_type beta, DMatrixSliceSym *sym_lhs) const
Perform a rank-k update of a dense symmetric matrix of the form:
DVectorSlice col(size_type j)
Return DVectorSlice object representing the jth column (1-based; 1,2,..,#this->cols()#) ...
void Vp_StMtV(DVectorSlice *vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1, const DVectorSlice &vs_rhs2, value_type beta) const
Create an eta vector (scaled by alpha = default 1).
DMatrixSliceTriEle nonconst_tri_ele(DMatrixSlice gms, BLAS_Cpp::Uplo uplo)
Return a triangular element-wise matrix.
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
MatrixSymDiagSparse()
The default value of num_updates_at_once == 0 is set to allow this class to determine the appropriate...
void sqrt(DVectorSlice *vs_lhs, const DVectorSlice &vs_rhs)
vs_lhs = sqrt(vs_rhs)
std::ostream & output(std::ostream &out) const
void assign(DMatrix &gm_lhs, const T_Matrix &gm_rhs, BLAS_Cpp::Transp trans_rhs)
gm_lhs = T_M (templated matrix type T_M)
Transp trans_not(Transp _trans)
Return the opposite of the transpose argument.
void V_MtV(VectorMutable *v_lhs, const MatrixOp &M_rhs1, BLAS_Cpp::Transp trans_rhs1, const V &V_rhs2)
v_lhs = op(M_rhs1) * V_rhs2.
Sparse storage element type.
void Vp_MtV_assert_sizes(size_type v_lhs_size, size_type m_rhs1_rows, size_type m_rhs1_cols, BLAS_Cpp::Transp trans_rhs1, size_type v_rhs2_size)
v_lhs += op(m_rhs1) * v_rhs2
virtual size_type rows() const
Return the number of rows in the matrix.
void MtV_assert_sizes(size_type m_rhs1_rows, size_type m_rhs1_cols, BLAS_Cpp::Transp trans_rhs1, size_type v_rhs2_size)
op(m_rhs1) * v_rhs2
FortranTypes::f_dbl_prec f_dbl_prec
size_type cols(size_type rows, size_type cols, BLAS_Cpp::Transp _trans)
Return columns of a possible transposed matrix.
size_type nz() const
Return the number of non-zero elements.
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
void V_MtV(DVector &v_lhs, const T_Matrix &gm_rhs1, BLAS_Cpp::Transp trans_rhs1, const DVectorSlice &vs_rhs2)
v_lhs = T_M * vs_lhs (templated matrix type T_M)
void Mp_StMtMtM(DMatrixSliceSym *sym_lhs, value_type alpha, EMatRhsPlaceHolder dummy_place_holder, const MatrixOpSerial &mwo_rhs, BLAS_Cpp::Transp mwo_rhs_trans, value_type beta) const
Computes the dense symmetric matrix B += a*op(A')*M*op(A).
index_type num_nonzeros(EExtractRegion extract_region, EElementUniqueness element_uniqueness) const