75 gms_lhs->col(i) = alpha;
83 gms_lhs->col(i) =
col(gms_rhs,trans_rhs,i);
89 switch(gms_lhs->overlap(gms_rhs)) {
91 i_assign_basic(gms_lhs,gms_rhs,trans_rhs);
97 i_assign_basic(gms_lhs,temp(),trans_rhs);
113 for(
int i = 1; i <= n; ++i) {
114 col(tri_lhs->gms(),trans_lhs,i)(i,n) =
col(tri_rhs.gms(),trans_rhs,i)(i,n);
123 if(!gm_lhs->
rows()) gm_lhs->
resize(1,1,alpha);
124 i_assign(&(*gm_lhs)(),alpha);
135 i_assign(&(*gm_lhs)(), tmp(), trans_rhs);
140 i_assign(&(*gm_lhs)(), gms_rhs, trans_rhs);
148 !gms_lhs->
rows(), std::length_error
149 ,
"Error, assign(gms_lhs,alpha): You can not assign Scalar to an unsized DMatrixSlice" );
150 i_assign(gms_lhs, alpha);
157 i_assign(gms_lhs, gms_rhs, trans_rhs);
164 !tri_lhs->
gms().
rows(), std::length_error
165 ,
"Error, assign(tri_lhs,alpha): You can not assign a scalar to an unsized triangular DMatrixSlice" );
171 for(
int i = 1; i <= n; ++i)
172 col( tri_lhs->
gms(), trans_lhs , i )(i,n) = alpha;
182 if(tri_lhs->
uplo() == tri_rhs.
uplo())
return;
188 if(tri_lhs->
uplo() != tri_rhs.
uplo()) {
190 ? &tri_lhs->
gms() : &tri_rhs.
gms();
192 ? &tri_lhs->
gms() : &tri_rhs.
gms();
195 i_assign_basic(tri_lhs, tri_rhs);
202 i_assign_basic(tri_lhs,
tri_ele(temp(),tri_rhs.
uplo()));
207 i_assign_basic(tri_lhs, tri_rhs);
218 !gms_lhs->
rows(), std::length_error
219 ,
"Error, Mt_S(gms_lhs,alpha): You can not scale an unsized DMatrixSlice" );
220 for(
int j = 1; j <= gms_lhs->
cols(); ++j)
228 , gms_rhs.
rows(), gms_rhs.
cols(), trans_rhs);
230 prod( &gms_lhs->
col(j), vs_rhs,
col(gms_rhs,trans_rhs,j) );
235 !tri_lhs->
gms().
rows(), std::length_error
236 ,
"Error, Mt_S(tri_lhs,alpha): You can not scale an unsized triangular DMatrixSlice" );
242 Vt_S( &
col( tri_lhs->
gms(), trans_lhs , j )(j,n), alpha );
256 Vp_StV( &
col(tri_lhs->
gms(),trans_lhs,j)(j,n), alpha,
col(tri_ele_rhs.
gms(),trans_rhs,j)(j,n) );
265 , gms_rhs.
rows(), gms_rhs.
cols(), trans_rhs);
267 Vp_StV( &gms_lhs->
col(j), alpha,
col(gms_rhs,trans_rhs,j) );
280 Mp_StM( const_cast<DenseLinAlgPack::DMatrixSliceTriEle*>(
282 , alpha, tri_ele_rhs );
283 Mp_StM( const_cast<DenseLinAlgPack::DMatrixSliceTriEle*>(
285 , alpha, tri_ele_rhs );
293 , sym_rhs.
rows(), sym_rhs.
cols(), trans_rhs);
296 switch(sym_rhs.
uplo()) {
314 , tri_rhs.
rows(), tri_rhs.
cols(), trans_rhs );
334 Mp_StM( const_cast<DenseLinAlgPack::DMatrixSliceTriEle*>(
339 Mp_StM( const_cast<DenseLinAlgPack::DMatrixSliceTriEle*>(
340 &
tri_ele((*gms_lhs)(1,n-1,2,n),upper) )
396 ,trans_rhs1,vs_rhs2.
dim() );
401 V_MtV(vs_lhs, tri_rhs1, trans_rhs1, vs_rhs2);
402 if(alpha != 1.0)
Vt_S(vs_lhs,alpha);
406 if(beta != 1.0)
Vt_S(vs_lhs,beta);
408 V_MtV(&tmp, tri_rhs1, trans_rhs1, vs_rhs2);
409 Vp_StV(vs_lhs,alpha,tmp());
443 gms_lhs->
rows(), gms_lhs->
cols(), alpha
481 , gms_rhs1.
rows(), gms_rhs1.
cols(), trans_rhs1
482 , gms_rhs2.
rows(), gms_rhs2.
cols(), trans_rhs2);
501 BLAS_Cpp::symm(side,sym_rhs.uplo(),gms_lhs->rows(),gms_lhs->cols()
502 ,alpha,sym_rhs.gms().col_ptr(1),sym_rhs.gms().max_rows()
503 ,gms_rhs.col_ptr(1),gms_rhs.max_rows()
504 ,beta,gms_lhs->col_ptr(1),gms_lhs->max_rows() );
515 , gms_rhs2.
rows(), gms_rhs2.
cols(), trans_rhs2);
522 assign(&tmp,gms_rhs2,trans_rhs2);
532 , gms_rhs1.
rows(), gms_rhs1.
cols(), trans_rhs1
540 assign(&tmp,gms_rhs1,trans_rhs1);
585 ,alpha,tri_rhs.gms().col_ptr(1),tri_rhs.gms().max_rows()
586 ,gms_lhs->col_ptr(1),gms_lhs->max_rows() );
597 assign(gms_lhs,gms_rhs,trans_gms_rhs);
598 i_trmm( side, trans_tri_rhs, alpha, tri_rhs, gms_lhs );
609 ,alpha,tri_rhs.gms().col_ptr(1),tri_rhs.gms().max_rows()
610 ,gms_lhs->col_ptr(1),gms_lhs->max_rows() );
621 assign(gms_lhs,gms_rhs,trans_gms_rhs);
622 i_trsm( side, trans_tri_rhs, alpha, tri_rhs, gms_lhs );
632 , gms_rhs2.
rows(), gms_rhs2.
cols(), trans_rhs2 );
635 i_trmm_alt(
BLAS_Cpp::left,alpha,tri_rhs1,trans_rhs1,gms_rhs2,trans_rhs2,&(*gm_lhs)());
644 , gms_rhs2.
rows(), gms_rhs2.
cols(), trans_rhs2 );
645 i_trmm_alt(
BLAS_Cpp::left,alpha,tri_rhs1,trans_rhs1,gms_rhs2,trans_rhs2,gms_lhs);
656 i_trmm_alt(
BLAS_Cpp::right,alpha,tri_rhs2,trans_rhs2,gms_rhs1,trans_rhs1,&(*gm_lhs)());
664 , gms_rhs1.
rows(), gms_rhs1.
cols(), trans_rhs1
666 i_trmm_alt(
BLAS_Cpp::right,alpha,tri_rhs2,trans_rhs2,gms_rhs1,trans_rhs1,gms_lhs);
681 if(beta != 1.0)
Mt_S(gms_lhs,beta);
683 M_StMtM(&tmp,alpha,tri_rhs1,trans_rhs1,gms_rhs2,trans_rhs2);
700 if(beta != 1.0)
Mt_S(gms_lhs,beta);
702 M_StMtM(&tmp,alpha,gms_rhs1,trans_rhs1,tri_rhs2,trans_rhs2);
712 , gms_rhs2.
rows(), gms_rhs2.
cols(), trans_rhs2 );
715 i_trsm_alt(
BLAS_Cpp::left,alpha,tri_rhs1,trans_rhs1,gms_rhs2,trans_rhs2,&(*gm_lhs)());
724 , gms_rhs2.
rows(), gms_rhs2.
cols(), trans_rhs2 );
725 i_trsm_alt(
BLAS_Cpp::left,alpha,tri_rhs1,trans_rhs1,gms_rhs2,trans_rhs2,gms_lhs);
736 i_trsm_alt(
BLAS_Cpp::right,alpha,tri_rhs2,trans_rhs2,gms_rhs1,trans_rhs1,&(*gm_lhs)());
744 , gms_rhs1.
rows(), gms_rhs1.
cols(), trans_rhs1
746 i_trsm_alt(
BLAS_Cpp::right,alpha,tri_rhs2,trans_rhs2,gms_rhs1,trans_rhs1,gms_lhs);
void M_StMtM(MatrixOp *M_lhs, value_type alpha, const MatrixOp &M_rhs1, BLAS_Cpp::Transp trans_rhs1, const MatrixOp &M_rhs2, BLAS_Cpp::Transp trans_rhs2)
M_lhs = alpha * op(M_rhs1) * op(M_rhs2).
void V_MtV(DVector *v_lhs, const DMatrixSliceTri &tri_rhs1, BLAS_Cpp::Transp trans_rhs1, const DVectorSlice &vs_rhs2)
Teuchos::Ordinal size_type
Typedef for the size type of elements that are used by the library.
AbstractLinAlgPack::size_type size_type
void assert_gms_square(const DMatrixSlice &gms)
Assert a matrix is square and throws length_error if it is not (LINALGPACK_CHECK_SLICE_SETUP).
EOverLap overlap(const DMatrixSlice &gms) const
void trsv(Uplo uplo, Transp trans, Diag diag, f_int n, const f_dbl_prec *pa, f_int lda, f_dbl_prec *px, f_int incx)
size_type dim() const
Returns the number of elements of the VectorSliceTmpl.
DenseLinAlgPack::size_type size_type
void assign(DMatrix *gm_lhs, value_type alpha)
gm_lhs = alpha (elementwise)
void MtM_assert_sizes(size_type m_rhs1_rows, size_type m_rhs1_cols, BLAS_Cpp::Transp trans_rhs1, size_type m_rhs2_rows, size_type m_rhs2_cols, BLAS_Cpp::Transp trans_rhs2)
op(m_lhs) += op(m_rhs1)
void Vt_S(VectorMutable *v_lhs, const value_type &alpha)
v_lhs *= alpha
BLAS_Cpp::Uplo uplo() const
size_type cols() const
Return the number of columns.
const DMatrixSliceTriEle tri_ele(const DMatrixSlice &gms, BLAS_Cpp::Uplo uplo)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void M_StMtM(DMatrix *gm_lhs, value_type alpha, const DMatrixSliceTri &tri_rhs1, BLAS_Cpp::Transp trans_rhs1, const DMatrixSlice &gms_rhs2, BLAS_Cpp::Transp trans_rhs2)
void Vp_StV(VectorMutable *v_lhs, const value_type &alpha, const Vector &v_rhs)
v_lhs = alpha * v_rhs + v_lhs
size_type rows(size_type rows, size_type cols, BLAS_Cpp::Transp _trans)
Return rows of a possible transposed matrix.
void syr2(Uplo uplo, f_int n, f_dbl_prec alpha, const f_dbl_prec *px, f_int incx, const f_dbl_prec *py, f_int incy, f_dbl_prec *pa, f_int lda)
void assign(VectorMutable *v_lhs, const V &V_rhs)
v_lhs = V_rhs.
VectorSliceTmpl< value_type > DVectorSlice
void assert_gms_sizes(const DMatrixSlice &gms1, BLAS_Cpp::Transp trans1, const DMatrixSlice &gms2, BLAS_Cpp::Transp trans2)
Assert two matrices are the same size and throws length_error if they are not (LINALGPACK_CHECK_RHS_S...
void resize(size_type n, value_type val=value_type())
void symm(Side side, Uplo uplo, f_int m, f_int n, f_dbl_prec alpha, const f_dbl_prec *pa, f_int lda, const f_dbl_prec *pb, f_int ldb, f_dbl_prec beta, f_dbl_prec *pc, f_int ldc)
void M_StMtInvM(DMatrix *gm_lhs, value_type alpha, const DMatrixSlice &gms_rhs1, BLAS_Cpp::Transp trans_rhs1, const DMatrixSliceTri &tri_rhs2, BLAS_Cpp::Transp trans_rhs2)
void syr2k(BLAS_Cpp::Transp trans, value_type alpha, const DMatrixSlice &gms_rhs1, const DMatrixSlice &gms_rhs2, value_type beta, DMatrixSliceSym *sym_lhs)
void Mp_MtM_assert_sizes(size_type m_lhs_rows, size_type m_lhs_cols, BLAS_Cpp::Transp trans_lhs, size_type m_rhs1_rows, size_type m_rhs1_cols, BLAS_Cpp::Transp trans_rhs1, size_type m_rhs2_rows, size_type m_rhs2_cols, BLAS_Cpp::Transp trans_rhs2)
op(m_lhs) += op(m_rhs1) * op(m_rhs2)
void Mp_M_assert_sizes(size_type m_lhs_rows, size_type m_lhs_cols, BLAS_Cpp::Transp trans_lhs, size_type m_rhs_rows, size_type m_rhs_cols, BLAS_Cpp::Transp trans_rhs)
op(m_lhs) += op op(m_rhs)
void ger(value_type alpha, const DVectorSlice &vs_rhs1, const DVectorSlice &vs_rhs2, DMatrixSlice *gms_lhs)
BLAS_Cpp::Uplo uplo() const
void syrk(BLAS_Cpp::Transp trans, value_type alpha, const DMatrixSlice &gms_rhs, value_type beta, DMatrixSliceSym *sym_lhs)
const DMatrixSliceTri tri(const DMatrixSlice &gms, BLAS_Cpp::Uplo uplo, BLAS_Cpp::Diag diag)
value_type * raw_ptr()
Return a pointer to the address of the first memory location of underlying array. ...
void Vp_V_assert_sizes(size_type v_lhs_size, size_type v_rhs_size)
v_lhs += op v_rhs
void V_InvMtV(DVector *v_lhs, const DMatrixSliceTri &tri_rhs1, BLAS_Cpp::Transp trans_rhs1, const DVectorSlice &vs_rhs2)
size_type max_rows() const
Return the number of rows in the full matrix. Equivalent to BLAS LDA argument.
void assert_gms_lhs(const DMatrixSlice &gms_lhs, size_type rows, size_type cols, BLAS_Cpp::Transp trans_rhs=BLAS_Cpp::no_trans)
size_type rows() const
Return the number of rows.
void prod(DVectorSlice *vs_lhs, const DVectorSlice &vs_rhs1, const DVectorSlice &vs_rhs2)
vs_lhs(i) = vs_rhs1(i) * vs_rhs2(i), i = 1...n
void syr2k(Uplo uplo, Transp trans, f_int n, f_int k, f_dbl_prec alpha, const f_dbl_prec *pa, f_int lda, const f_dbl_prec *pb, f_int ldb, f_dbl_prec beta, f_dbl_prec *pc, f_int ldc)
void syr(value_type alpha, const DVectorSlice &vs_rhs, DMatrixSliceSym *sym_lhs)
value_type * raw_ptr()
Return a pointer to the address of the first memory location of underlying array. ...
value_type * col_ptr(size_type j)
void Mt_S(DMatrixSlice *gms_lhs, value_type alpha)
gms_lhs *= alpha (BLAS xSCAL)
DenseLinAlgPack::DMatrixSliceTriEle DMatrixSliceTriEle
BLAS_Cpp::Uplo uplo() const
void Mp_StMtM(DMatrixSlice *gms_lhs, value_type alpha, const DMatrixSlice &gms_rhs1, BLAS_Cpp::Transp trans_rhs1, const DMatrixSlice &gms_rhs2, BLAS_Cpp::Transp trans_rhs2, value_type beta=1.0)
void gemm(Transp transa, Transp transb, f_int m, f_int n, f_int k, f_dbl_prec alpha, const f_dbl_prec *pa, f_int lda, const f_dbl_prec *pb, f_int ldb, f_dbl_prec beta, f_dbl_prec *pc, f_int ldc)
void syr2(value_type alpha, const DVectorSlice &vs_rhs1, const DVectorSlice &vs_rhs2, DMatrixSliceSym *sym_lhs)
void Mp_StM(MatrixOp *mwo_lhs, value_type alpha, const MatrixOp &M_rhs, BLAS_Cpp::Transp trans_rhs)
DVectorSlice col(DMatrixSlice &gms, BLAS_Cpp::Transp trans, size_type j)
void resize(size_type rows, size_type cols, value_type val=value_type())
Resize matrix to a (rows x cols) matrix and initializes any added elements by val.
EOverLap overlap(const VectorSliceTmpl< value_type > &vs) const
void Mt_S(MatrixOp *mwo_lhs, value_type alpha)
void VopV_assert_sizes(size_type v_rhs1_size, size_type v_rhs2_size)
v_rhs1 op v_rhs2
void syr(Uplo uplo, f_int n, f_dbl_prec alpha, const f_dbl_prec *px, f_int incx, f_dbl_prec *pa, f_int lda)
Transp trans_not(Transp _trans)
Return the opposite of the transpose argument.
size_type rows() const
Return the number of rows.
BLAS_Cpp::Diag diag() const
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.
AbstractLinAlgPack::value_type value_type
difference_type stride() const
Return the distance (+,-) (in units of elements) between adjacent elements in the underlying array...
DenseLinAlgPack::DMatrixSliceTri DMatrixSliceTri
void Vp_S(VectorMutable *v_lhs, const value_type &alpha)
v_lhs += alpha
DVectorSlice diag(difference_type k=0)
void Mp_StM(DMatrixSliceTriEle *tri_lhs, value_type alpha, const DMatrixSliceTriEle &tri_rhs)
tri_lhs += alpha * tri_rhs (BLAS xAXPY)
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
FortranTypes::f_dbl_prec value_type
Typedef for the value type of elements that is used for the library.
VectorTmpl< value_type > DVector
void Vp_StMtV(DVectorSlice *vs_lhs, value_type alpha, const DMatrixSlice &gms_rhs1, BLAS_Cpp::Transp trans_rhs1, const DVectorSlice &vs_rhs2, value_type beta=1.0)
vs_lhs = alpha * op(gms_rhs1) * vs_rhs2 + beta * vs_lhs (BLAS xGEMV)
void ger(f_int m, f_int n, f_dbl_prec alpha, const f_dbl_prec *px, f_int incx, const f_dbl_prec *py, f_int incy, f_dbl_prec *pa, f_int lda)
void trsm(Side side, Uplo uplo, Transp transa, Diag diag, f_int m, f_int n, f_dbl_prec alpha, const f_dbl_prec *pa, f_int lda, f_dbl_prec *pb, f_int ldb)
void resize_gm_lhs(DMatrix *gm_rhs, size_type rows, size_type cols, BLAS_Cpp::Transp trans_rhs)
Utility to resize a DMatrix to the size of a rhs matrix.
void symv(Uplo uplo, f_int n, f_dbl_prec alpha, const f_dbl_prec *pa, f_int lda, const f_dbl_prec *x, f_int incx, f_dbl_prec beta, f_dbl_prec *py, f_int incy)
void M_diagVtM(DMatrixSlice *gms_lhs, const DVectorSlice &vs_rhs, const DMatrixSlice &gms_rhs, BLAS_Cpp::Transp trans_rhs)
gms_lhs = diag(vs_rhs) * op(gms_rhs) [Row or column scaling]
void gemv(Transp transa, f_int m, f_int n, f_dbl_prec alpha, const f_dbl_prec *pa, f_int lda, const f_dbl_prec *x, f_int incx, f_dbl_prec beta, f_dbl_prec *py, f_int incy)
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
DenseLinAlgPack::DMatrixSlice DMatrixSlice
void syrk(Uplo uplo, Transp trans, f_int n, f_int k, f_dbl_prec alpha, const f_dbl_prec *pa, f_int lda, f_dbl_prec beta, f_dbl_prec *pc, f_int ldc)
EOverLap overlap(const DMatrixSlice &gms) const
DenseLinAlgPack::DMatrixSliceSym DMatrixSliceSym
DVectorSlice col(size_type j)
Return DVectorSlice object representing the jth column (1-based; 1,2,..,#this->cols()#, or throw std::out_of_range)
void trmv(Uplo uplo, Transp trans, Diag diag, f_int n, const f_dbl_prec *pa, f_int lda, f_dbl_prec *px, f_int incx)
DenseLinAlgPack::DMatrix DMatrix
size_type cols(size_type rows, size_type cols, BLAS_Cpp::Transp _trans)
Return columns of a possible transposed matrix.
void M_StInvMtM(DMatrix *gm_lhs, value_type alpha, const DMatrixSliceTri &tri_rhs1, BLAS_Cpp::Transp trans_rhs1, const DMatrixSlice &gms_rhs2, BLAS_Cpp::Transp trans_rhs2)
void trmm(Side side, Uplo uplo, Transp transa, Diag diag, f_int m, f_int n, f_dbl_prec alpha, const f_dbl_prec *pa, f_int lda, f_dbl_prec *pb, f_int ldb)