71 , std::ostream*
out,
bool* success )
91 tmp2->
resize( tmp1->dim() );
93 for(
int i = 0; i < 2; ++i, alpha -= 0.5 ) {
95 for(
int j = 0; j < 3; ++j, beta += 0.5 ) {
97 *out <<
"vs_lhs = " << alpha <<
" * M_rhs1"
99 <<
" * vs_rhs2 + " << beta <<
" * vs_lhs : ";
101 for(
int k = 1; k <= tmp1->dim(); ++k )
102 (*tmp1)(k) = (*tmp2)(k) = k;
104 Vt_S( &(*tmp1)(), beta );
105 Vp_StV( &(*tmp1)(), alpha, expected_MtV );
107 Vp_StMtV( &(*tmp2)(), alpha, M_rhs1, trans_rhs1, vs_rhs2, beta );
110 if(out) *out << result << std::endl;
111 if(out && !result) *out <<
"expected_vs_lhs =\n" << *tmp1
112 <<
"computed_vs_lhs =\n"<< *tmp2;
140 for(
int i = 1; i <= 3; ++i ) {
158 B_trans_chr = (trans_B==
no_trans?
' ':
'\''),
159 I_trans_chr = (trans_I==
no_trans?
' ':
'\'');
162 rows_B =
rows( B.rows(), B.cols(), trans_B ),
163 cols_B =
cols( B.rows(), B.cols(), trans_B );
164 C1->resize(rows_B,cols_B);
166 Mp_StM( &(*C1)(), 1.0, B, trans_B );
168 if(out) *out <<
"C = " << alpha <<
" * B" << B_trans_chr
169 <<
"* I" << I_trans_chr <<
" + " << beta <<
" * (0.5) * B" << B_trans_chr
171 C2->resize(rows_B,cols_B);
173 Mp_StM( &(*C2)(), 0.5, B, trans_B );
175 Mp_StMtM( &(*C2)(), alpha, B, trans_B, I(1,n,1,n), trans_I, beta );
177 if(out) *out << result << std::endl;
178 if( out && !result ) *out <<
"C1 =\n" << (*C1) <<
"C2 =\n" << (*C2);
180 if(out) *out <<
"C = " << alpha <<
" * I" << I_trans_chr
181 <<
"* B" << B_trans_chr <<
" + " << beta <<
" * (0.5) * B" << B_trans_chr
184 Mp_StM( &(*C2)(), 0.5, B, trans_B );
185 n =
rows( B.rows(), B.cols(), trans_B );
186 Mp_StMtM( &(*C2)(), alpha, I(1,n,1,n), trans_I, B, trans_B, beta );
188 if(out) *out << result << std::endl;
189 if( out && !result ) *out <<
"C1 =\n" << (*C1) <<
"C2 =\n" << (*C2);
210 bool result, result1, result2;
213 *out <<
"\n**************************************"
214 <<
"\n*** Testing GenMatrixOp Operations ***"
215 <<
"\n**************************************\n"
216 << std::boolalpha << std::setw(10);
221 char str_uplo[2][10] = {
"lower",
"upper" };
224 char str_diag[2][10] = {
"unit",
"nonunit" };
237 { 1.1, 2.1, 3.1, 4.1, 5.1, 6.1,
238 1.2, 2.2, 3.2, 4.2, 5.2, 6.2,
239 1.3, 2.3, 3.3, 4.3, 5.3, 6.3,
240 1.4, 2.4, 3.4, 4.4, 5.4, 6.4,
241 1.5, 2.5, 3.5, 4.5, 5.5, 6.5,
242 1.6, 2.6, 3.6, 4.6, 5.6, 6.6,
243 1.7, 2.7, 3.7, 4.7, 5.7, 6.7,
244 1.8, 2.8, 3.8, 4.8, 5.8, 6.8 };
247 const DMatrixSlice gms_rhs(const_cast<value_type*>(ptr),m*n,m,m,n);
252 if(out) *out <<
"\n***\n*** Test Element-wise Assignment functions not already "
253 "tested in TestGenMatrixClass(...)\n***\n";
256 if(out) *out <<
"\ngms_lhs = op(gms_rhs)\n"
257 <<
"\ngm_lhs.resize(n,m); assign( &gm_lhs(), gms_rhs, trans );\n";
261 if(out && !result) *out <<
"gm_lhs =\n" << gm_lhs();
262 if(out) *out <<
"gm_lhs == gms_rhs' : " << result << std::endl;
265 if(out) *out <<
"\ngm_lhs = op(gms_rhs)\n"
266 <<
"\ngm_lhs.resize(1,1); assign( &gm_lhs, gms_rhs, trans );\n";
270 if(out && !result) *out <<
"gm_lhs =\n" << gm_lhs();
271 if(out) *out <<
"gm_lhs == gms_rhs' : " << result << std::endl;
275 if(out) *out <<
"\ntri_ele_gms_lhs = alpha (elementwise)\n";
277 if(out) *out <<
"\ngms_lhs.resize(m,m); gm_lhs = 1.0; assign(&nonconst_tri_ele(gm_lhs(),lower),2.0);\n";
283 if(out && (!result1 || !result2) )
284 *out <<
"gm_lhs =\n" << gm_lhs();
285 if(out) *out <<
"tri_ele(gm_lhs(),lower) == 2.0 : " << result1 << std::endl
286 <<
"tri_ele(gm_lhs(1,m-1,2,m),upper) == 1.0 : " << result2 << std::endl;
288 if(out) *out <<
"\nassign(&tri_ele(gm_lhs(1,m-1,2,m),upper),3.0);\n";
292 if(out && (!result1 || !result2) )
293 *out <<
"gm_lhs =\n" << gm_lhs();
294 if(out) *out <<
"tri_ele(gm_lhs(),lower) == 2.0 : " << result1 << std::endl
295 <<
"tri_ele(gm_lhs(1,m-1,2,m),upper) == 3.0 : " << result2 << std::endl;
299 if(out) *out <<
"\ntri_ele_gms_lhs = tri_ele_gms_rhs\n"
300 <<
"\nassign(&tri_ele(gm_lhs(2,m,1,m-1),lower),tri_ele(gms_rhs(1,m-1,2,m),upper));\n";
302 if(out) *out <<
"assign(&tri_ele(gm_lhs(1,m-1,2,m),upper),tri_ele(gms_rhs(2,m,1,m-1),lower));\n";
304 if(out) *out <<
"gm_lhs.diag() = gms_rhs.diag();\n";
305 gm_lhs.diag() = gms_rhs.
diag();
306 update_success( result1 =
comp( gm_lhs(1,m,1,m),
no_trans, gms_rhs(1,m,1,m),
trans ), &success );
307 update_success( result2 =
comp(
tri_ele(gm_lhs(2,m,1,m-1),
lower),
tri_ele(gms_rhs(1,m-1,2,m),
upper) ), &success );
308 if(out && (!result1 || !result2) )
309 *out <<
"gm_lhs =\n" << gm_lhs();
310 if(out) *out <<
"gm_lhs(1,m,1,m) == gms_rhs(1,m,1,m)' : " << result1 << std::endl
311 <<
"tri_ele(gm_lhs(2,m,1,m-1),lower) == tri_ele(gms_rhs(1,m-1,2,m),upper) : " << result2 << std::endl;
316 if(out) *out <<
"\n***\n*** Test Element-wise Algebraic Operations\n***\n";
319 if(out) *out <<
"\ngms_lhs *= alpha\n"
320 <<
"\ngm_lhs = 1.0; Mt_S( &gm_lhs(), 2.0 );\n";
322 Mt_S( &gm_lhs(), 2.0 );
325 *out <<
"gm_lhs =\n" << gm_lhs();
326 if(out) *out <<
"gm_lhs == 2.0: " << result << std::endl;
330 if(out) *out <<
"\ntri_lhs *= alpha\n"
331 <<
"\ngm_lhs = 1.0;\nLet tm1 = tri_ele(gm_lhs(1,m,1,m),BLAS_Cpp::lower), "
332 "tm2 = tri_ele(gm_lhs(1,m-1,2,m),BLAS_Cpp::upper)\n";
337 if(out) *out <<
"Mt_S( &tm1, 2.0 );\n";
339 if(out) *out <<
"Mt_S( &tm2, 3.0 );\n";
343 if(out && (!result1 || !result2) )
344 *out <<
"gm_lhs =\n" << gm_lhs();
345 if(out) *out <<
"tm1 == 2.0 : " << result1 << std::endl
346 <<
"tm2 == 3.0 : " << result2 << std::endl;
350 if(out) *out <<
"\ntri_lhs += alpha * tri_rhs\n"
353 if(out) *out <<
"Mp_StM( &tri_ele(gm_lhs(2,m,1,m-1),lower), 2.0, tri_ele(gm_lhs(1,m-1,2,m),upper) );\n";
354 Mp_StM( &
nonconst_tri_ele(gm_lhs(2,m,1,m-1),
lower), 2.0,
tri_ele(gm_lhs(1,m-1,2,m),
upper) );
357 if(out && (!result1 || !result2) )
358 *out <<
"gm_lhs =\n" << gm_lhs();
359 if(out) *out <<
"tri_ele(gm_lhs(2,m,1,m-1),lower) == 3.0 : " << result1 << std::endl
360 <<
"tri_ele(gm_lhs(1,m,1,m),upper) == 1.0 : " << result2 << std::endl;
363 if(out) *out <<
"\n****** LinAlgOpPack compatable (Mp_StM(...))\n";
366 if(out) *out <<
"\ngms_lhs += alpha * op(gms_rhs)\n"
367 "--------------------------\n"
368 "gm_lhs.resize(m,n); gm_lhs = 0.0;"
369 "Mp_StM( &gm_lhs(), 0.5, gm_rhs(), no_trans ); "
370 "Mp_StM( &gm_lhs(), 0.5, gm_rhs(), no_trans );\n";
377 *out <<
"gm_lhs =\n" << gm_lhs();
378 if(out) *out <<
"gm_lhs == gm_rhs : " << result << std::endl;
381 if(out) *out <<
"\ngms_lhs += alpha * op(sym_rhs)\n"
382 "------------------------------\n";
384 {
for(
int i_uplo = 0; i_uplo < 2; ++i_uplo) {
385 for(
int i_trans = 0; i_trans < 2; ++i_trans) {
390 <<
"gms_lhs += alpha * sym(gms_rhs(1,m,1,m),"
391 << str_uplo[i_uplo] <<
")" << (_trans ==
trans ?
'\'' :
' ' ) <<
" : ";
394 Mp_StM( &gm_lhs(), 0.5, M, _trans );
395 Mp_StM( &gm_lhs(), 0.5, M, _trans );
400 if(out) *out << ( result1 && result2 ) << std::endl;
401 if( out && ( !result1 || !result2 ) )
402 *out <<
"gm_lhs =\n" << gm_lhs();
407 if(out) *out <<
"\ngms_lhs += alpha * op(tri_rhs)\n"
408 "------------------------------\n";
410 {
for(
int i_uplo = 0; i_uplo < 2; ++i_uplo) {
411 for(
int i_diag = 0; i_diag < 2; ++i_diag) {
412 for(
int i_trans = 0; i_trans < 2; ++i_trans) {
418 <<
"gms_lhs += alpha * tri(gms_rhs(1,m,1,m),"
419 << str_uplo[i_uplo] <<
"," << str_diag[i_diag] <<
")"
420 << (_trans ==
trans ?
'\'' :
' ' ) <<
" : ";
424 Mp_StM( &gm_lhs(), 0.5, M, _trans );
425 Mp_StM( &gm_lhs(), 0.5, M, _trans );
428 result =
comp( gm_lhs.diag(), gms_rhs.
diag() );
430 result =
comp( gm_lhs.diag(), 1.0 );
439 M_ele =
tri_ele( ( _uplo==lower ? M.
gms()(2,m,1,m-1) : M.
gms()(1,m-1,2,m) )
441 tri_reg_ele =
tri_ele( ( as_uplo==lower ? gm_lhs(2,m,1,m-1) : gm_lhs(1,m-1,2,m) )
443 oth_tri_reg_ele =
tri_ele( ( oth_as_uplo==lower ? gm_lhs(2,m,1,m-1) : gm_lhs(1,m-1,2,m) )
447 if(out) *out << ( result && result1 && result2 ) << std::endl;
448 if( out && ( !result || !result1 || !result2 ) )
449 *out <<
"gm_lhs =\n" << gm_lhs();
457 if(out) *out <<
"\n***\n*** Level-2 BLAS \n***\n";
459 DVector tmp1, tmp2, vs_rhs(n), expected_MtV;
460 {
for(
int k = 1; k <= n; ++k) vs_rhs(k) = k; }
463 if(out) *out <<
"\n*** BLAS-2 Equivalent Triangular Matrix operations\n";
465 {
for(
int i_uplo = 0; i_uplo < 2; ++i_uplo) {
466 for(
int i_diag = 0; i_diag < 2; ++i_diag) {
467 for(
int i_trans = 0; i_trans < 2; ++i_trans) {
469 *out <<
"\nLet M = tri(gms_rhs(1,m,1,m)," << str_uplo[i_uplo]
470 <<
"," << str_diag[i_diag] <<
")"
471 << (a_trans[i_trans] ==
trans ?
'\'' :
' ' ) << std::endl;
476 V_InvMtV( &tmp1, M, a_trans[i_trans], vs_rhs(1,m) );
477 V_MtV( &tmp2, M, a_trans[i_trans], tmp1() );
479 if(out) *out <<
"(v_lhs)... M * (inv(M)*vs_rhs(1,m)) == vs_rhs(1,m) : "
480 << result << std::endl;
482 V_InvMtV( &tmp1(), M, a_trans[i_trans], vs_rhs(1,m) );
483 V_MtV( &tmp1(), M, a_trans[i_trans], tmp1() );
485 if(out) *out <<
"(vs_lhs)... M * (inv(M)*vs_rhs(1,m)) == vs_rhs(1,m) : "
486 << result << std::endl;
492 if(out) *out <<
"\n*** Test DenseLinAlgPack complient (Vp_StMtV(...))\n";
496 if(out) *out <<
"\n****** General Matrix MtV\n";
499 if(out) *out <<
"\nvs_lhs = alpha * gms_rhs1 * vs_rhs2 + beta * vs_lhs (xGEMV)\n";
502 {
for(
int i=1;i<=m;++i)
503 for(
int j=1;j<=n;++j)
504 expected_MtV(i) += gms_rhs(i,j) * vs_rhs(j);
506 test_MtV( gms_rhs,
no_trans, vs_rhs(1,n), expected_MtV, &tmp1, &tmp2
510 if(out) *out <<
"\nvs_lhs = alpha * gms_rhs1' * vs_rhs2 + beta * vs_lhs (xGEMV)\n";
513 {
for(
int i=1;i<=n;++i)
514 for(
int j=1;j<=m;++j)
515 expected_MtV(i) += gms_rhs(j,i) * vs_rhs(j);
517 test_MtV( gms_rhs,
trans, vs_rhs(1,m), expected_MtV, &tmp1, &tmp2
522 if(out) *out <<
"\n****** Symmetric Matrix MtV\n";
524 {
for(
int i_uplo = 0; i_uplo < 2; ++i_uplo) {
525 for(
int i_trans = 0; i_trans < 2; ++i_trans) {
528 <<
"\nvs_lhs = alpha * sym(gms_rhs(1,m,1,m),"
529 << str_uplo[i_uplo] <<
")"
530 << (a_trans[i_trans] ==
trans ?
'\'' :
' ' )
531 <<
" * vs_rhs2 + beta * vs_lhs (xSYMV)\n";
535 switch(a_uplo[i_uplo]) {
537 for(
int i=1;i<=m;++i)
538 for(
int j=1;j<=m;++j)
540 += (j < i ? gms_rhs(i,j) : gms_rhs(j,i) ) * vs_rhs(j);
544 for(
int i=1;i<=m;++i)
545 for(
int j=1;j<=m;++j)
547 += (j > i ? gms_rhs(i,j) : gms_rhs(j,i) ) * vs_rhs(j);
551 test_MtV(
sym(gms_rhs(1,m,1,m),a_uplo[i_uplo]), a_trans[i_trans]
552 , vs_rhs(1,m), expected_MtV, &tmp1, &tmp2, out, &success );
559 if(out) *out <<
"\n****** Triangular Matrix MtV\n";
561 {
for(
int i_uplo = 0; i_uplo < 2; ++i_uplo) {
562 for(
int i_diag = 0; i_diag < 2; ++i_diag) {
563 for(
int i_trans = 0; i_trans < 2; ++i_trans) {
569 <<
"\nvs_lhs = alpha * tri(gms_rhs(1,m,1,m),"
570 << str_uplo[i_uplo] <<
"," << str_diag[i_diag]
571 <<
")" << (_trans ==
trans ?
'\'' :
' ' )
572 <<
" * vs_rhs2 + beta * vs_lhs\n";
587 for(
int i=1;i<=m;++i) {
588 for(
int j=1;j<i;++j) {
590 _i = ( _trans ==
no_trans ? i : j ),
591 _j = ( _trans ==
no_trans ? j : i );
592 expected_MtV(i) += gms_rhs(_i,_j) * vs_rhs(j);
594 expected_MtV(i) += (_diag==
unit?1.0:gms_rhs(i,i))*vs_rhs(i);
599 for(
int i=1;i<=m;++i) {
600 expected_MtV(i) += (_diag==
unit?1.0:gms_rhs(i,i))*vs_rhs(i);
601 for(
int j=i+1;j<=m;++j) {
603 _i = ( _trans ==
no_trans ? i : j ),
604 _j = ( _trans ==
no_trans ? j : i );
605 expected_MtV(i) += gms_rhs(_i,_j) * vs_rhs(j);
611 test_MtV(
tri(gms_rhs(1,m,1,m),_uplo,_diag), _trans, vs_rhs(1,m)
612 , expected_MtV, &tmp1, &tmp2, out, &success );
619 if(out) *out <<
"\n*** Symmetric Matrix Updates\n";
622 if(out) *out <<
"\n****** sym_lhs = alpha * vs_rhs * vs_rhs' + sym_lhs (BLAS xSYR)\n";
629 {
for(
int i_uplo = 0; i_uplo < 2; ++i_uplo) {
632 *out <<
"\nFor sym_lhs = sym(gms_rhs(1,m,1,m)," << str_uplo[i_uplo]
637 for(
int i = 1; i<=m; ++i) {
638 for(
int j = i; j<=m; ++j) {
640 _i = (_uplo ==
upper ? i : j),
641 _j = (_uplo ==
upper ? j : i);
642 ex_gm_lhs(_i,_j) += alpha * vs_rhs(i) * vs_rhs(j);
651 *out <<
"gm_lhs =\n" << gm_lhs <<
"ex_gm_lhs =\n" << ex_gm_lhs();
652 if(out) *out <<
" gm_lhs == expected_gm_lhs : " << result << std::endl;
656 if(out) *out <<
"\n****** sym_lhs = alpha * vs_rhs1 * vs_rhs2' + alpha * vs_rhs2 * vs_rhs1' + sym_lhs (BLAS xSYR2)\n";
663 {
for(
int i_uplo = 0; i_uplo < 2; ++i_uplo) {
666 *out <<
"\nFor sym_lhs = sym(gms_rhs(1,m,1,m)," << str_uplo[i_uplo]
671 for(
int i = 1; i<=m; ++i) {
672 for(
int j = i; j<=m; ++j) {
674 _i = (_uplo ==
upper ? i : j),
675 _j = (_uplo ==
upper ? j : i);
676 ex_gm_lhs(_i,_j) += alpha * (vs_rhs(i) * vs_rhs2(j) + vs_rhs2(i) * vs_rhs(j));
685 *out <<
"gm_lhs =\n" << gm_lhs() <<
"ex_gm_lhs =\n" << ex_gm_lhs();
686 if(out) *out <<
" gm_lhs == expected_gm_lhs : " << result << std::endl;
692 if(out) *out <<
"\n***\n*** Level-3 BLAS\n***\n";
695 if(out) *out <<
"\n*** BLAS-2 Equivalent Triangular Matrix operations\n";
699 {
for(
int i_uplo = 0; i_uplo < 2; ++i_uplo) {
700 for(
int i_diag = 0; i_diag < 2; ++i_diag) {
701 for(
int i_trans1 = 0; i_trans1 < 2; ++i_trans1) {
702 for(
int i_trans2 = 0; i_trans2 < 2; ++i_trans2) {
704 _trans1 = a_trans[i_trans1],
705 _trans2 = a_trans[i_trans2];
707 *out <<
"\nLet M = tri(gms_rhs(1,m,1,m)," << str_uplo[i_uplo]
708 <<
"," << str_diag[i_diag] <<
")"
709 << trans_char(_trans1) << std::endl;
716 M_StInvMtM( &Tmp1, 2.0, M, _trans1, gms_rhs(1,m,1,m), _trans2 );
720 if(out) *out <<
"(gm_lhs,left)...0.5*M*(2*inv(M)*gms_rhs(1,m,1,m)"
721 << trans_char(_trans2) <<
")"
722 " == gms_rhs(1,m,1,m)" << trans_char(_trans2) <<
" : "
723 << result << std::endl;
727 assign( &Tmp2, gms_rhs(1,m,1,m), _trans2 );
734 <<
"(gms_lhs,left)...0.5*M*(2*inv(M)*gms_rhs(1,m,1,m)"
735 << trans_char(_trans2) <<
")"
736 " == gms_rhs(1,m,1,m)" << trans_char(_trans2) <<
" : "
737 << result << std::endl;
740 <<
"\ngms_lhs =\n" << Tmp2
741 <<
"\ngms_rhs(1,m,1,m) =\n" << gms_rhs(1,m,1,m);
749 M_StMtInvM( &Tmp1, 2.0, gms_rhs(1,m,1,m), _trans1, M, _trans2 );
753 if(out) *out <<
"(gm_lhs,right)...5.0*(2.0*gms_rhs(1,m,1,m)"
754 << trans_char(_trans1) <<
"*inv(M))*M"
755 " == gms_rhs(1,m,1,m)" << trans_char(_trans1) <<
" : "
756 << result << std::endl;
760 assign( &Tmp2(), gms_rhs(1,m,1,m), _trans1 );
765 if(out) *out <<
"(gms_lhs,right)...5.0*(2.0*gms_rhs(1,m,1,m)"
766 << trans_char(_trans1) <<
"*inv(M))*M"
767 " == gms_rhs(1,m,1,m)" << trans_char(_trans1) <<
" : "
768 << result << std::endl;
775 if(out) *out <<
"\n*** Test DenseLinAlgPack complient (Mp_StMtM(...))\n";
781 if(out) *out <<
"\n****** Rectangular MtM (BLAS xGEMV)\n";
784 {
for(
int i_trans_B = 0; i_trans_B < 2; ++i_trans_B) {
785 for(
int i_trans_I = 0; i_trans_I < 2; ++i_trans_I) {
787 _trans_B = a_trans[i_trans_B],
788 _trans_I = a_trans[i_trans_I];
789 if(out) *out <<
"\nLet B = gms_rhs\n";
790 test_MtM( gms_rhs, _trans_B, I, _trans_I, out, &Tmp1, &Tmp2, &success );
795 if(out) *out <<
"\n****** Symmetric MtM\n";
799 {
for(
int i_uplo = 0; i_uplo < 2; ++i_uplo) {
800 for(
int i_trans_B = 0; i_trans_B < 2; ++i_trans_B) {
801 for(
int i_trans_I = 0; i_trans_I < 2; ++i_trans_I) {
803 _uplo = a_uplo[i_uplo];
805 _trans_B = a_trans[i_trans_B],
806 _trans_I = a_trans[i_trans_I];
807 if(out) *out <<
"\nLet B = sym(gms_rhs(1,m,1,m)," << str_uplo[i_uplo] <<
")\n";
808 test_MtM(
sym(gms_rhs(1,m,1,m),_uplo), _trans_B, I, _trans_I, out
809 , &Tmp1, &Tmp2, &success );
815 if(out) *out <<
"\n****** Triangular MtM\n";
820 {
for(
int i_uplo = 0; i_uplo < 2; ++i_uplo) {
821 for(
int i_diag = 0; i_diag < 2; ++i_diag) {
822 for(
int i_trans_B = 0; i_trans_B < 2; ++i_trans_B) {
823 for(
int i_trans_I = 0; i_trans_I < 2; ++i_trans_I) {
825 _uplo = a_uplo[i_uplo];
827 _diag = a_diag[i_diag];
829 _trans_B = a_trans[i_trans_B],
830 _trans_I = a_trans[i_trans_I];
831 if(out) *out <<
"\nLet B = tri(gms_rhs(1,m,1,m)," << str_uplo[i_uplo]
832 <<
"," << str_diag[i_diag] <<
")\n";
833 test_MtM(
tri(gms_rhs(1,m,1,m),_uplo,_diag), _trans_B, I, _trans_I, out
834 , &Tmp1, &Tmp2, &success );
841 if(out) *out <<
"\n*** Symmetric Matrix updating\n";
843 if(out) *out <<
"\nWarning! Not Tested!\n";
849 catch(
const std::exception& excpt ) {
852 (*out) <<
"\nError, a standard exception was thrown: "
854 << excpt.what() << std::endl;
859 (*out) <<
"\nError, an unknown exception was thrown\n";
865 <<
"\n*** Congradulations, GenMatrixOp operations seem to check out. ***\n";
868 <<
"\n*** Oops, all of the tests for GenMatrixOp operations "
869 "where not successful. ***\n";
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).
Teuchos::Ordinal size_type
Typedef for the size type of elements that are used by the library.
AbstractLinAlgPack::size_type size_type
std::string typeName(const T &t)
void Vp_StV(DVectorSlice *vs_lhs, value_type alpha, const DVectorSlice &vs_rhs)
vs_lhs += alpha * vs_rhs (BLAS xAXPY)
void assign(DMatrix *gm_lhs, value_type alpha)
gm_lhs = alpha (elementwise)
void Mp_StMtM(MatrixOp *mwo_lhs, value_type alpha, const MatrixOp &mwo_rhs1, BLAS_Cpp::Transp trans_rhs1, const MatrixOp &mwo_rhs2, BLAS_Cpp::Transp trans_rhs2, value_type beta=1.0)
mwo_lhs = alpha * op(mwo_rhs1) * op(mwo_rhs2) + beta * mwo_lhs (right) (xGEMM).
void Vt_S(VectorMutable *v_lhs, const value_type &alpha)
v_lhs *= alpha
DVectorSlice diag(difference_type k=0)
bool trans_to_bool(Transp _trans)
Returns true if _trans == trans.
const DMatrixSliceTriEle tri_ele(const DMatrixSlice &gms, BLAS_Cpp::Uplo uplo)
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 M_StMtInvM(MatrixOp *m_lhs, value_type alpha, const MatrixOp &mwo_rhs1, BLAS_Cpp::Transp trans_rhs1, const MatrixNonsing &M_rhs2, BLAS_Cpp::Transp trans_rhs2)
m_lhs = alpha * op(mwo_rhs1) * inv(op(M_rhs2)) (left)
void assign(VectorMutable *v_lhs, const V &V_rhs)
v_lhs = V_rhs.
VectorSliceTmpl< value_type > DVectorSlice
int resize(OrdinalType length_in)
void resize(size_type n, value_type val=value_type())
const DMatrixSliceSym sym(const DMatrixSlice &gms, BLAS_Cpp::Uplo uplo)
const DMatrixSliceTri tri(const DMatrixSlice &gms, BLAS_Cpp::Uplo uplo, BLAS_Cpp::Diag diag)
DMatrixSliceSym nonconst_sym(DMatrixSlice gms, BLAS_Cpp::Uplo uplo)
Return a symmetric matrix.
const value_type sqrt_eps
const LAPACK_C_Decl::f_int & M
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 V_InvMtV(VectorMutable *v_lhs, const MatrixNonsing &M_rhs1, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2)
v_lhs = inv(op(M_rhs1)) * v_rhs2
void Mp_StM(MatrixOp *mwo_lhs, value_type alpha, const MatrixOp &M_rhs, BLAS_Cpp::Transp trans_rhs)
void Vp_StMtV(VectorMutable *v_lhs, value_type alpha, const MatrixOp &M_rhs1, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2, value_type beta=1.0)
v_lhs = alpha * op(M_rhs1) * v_rhs2 + beta * v_lhs (BLAS xGEMV)
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.
DMatrixSliceTriEle nonconst_tri_ele(DMatrixSlice gms, BLAS_Cpp::Uplo uplo)
Return a triangular element-wise matrix.
void Mt_S(MatrixOp *mwo_lhs, value_type alpha)
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)
DenseLinAlgPack::VectorSliceTmpl< value_type > DVectorSlice
void Vt_S(DVectorSlice *vs_lhs, value_type alpha)
vs_lhs *= alpha (BLAS xSCAL) (*** Note that alpha == 0.0 is handeled as vs_lhs = 0.0)
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
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)
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)
bool update_success(bool result_check, bool *success)
Helper function for updating a flag for if an operation returned false.
void M_StInvMtM(MatrixOp *m_lhs, value_type alpha, const MatrixNonsing &M_rhs1, BLAS_Cpp::Transp trans_rhs1, const MatrixOp &mwo_rhs2, BLAS_Cpp::Transp trans_rhs2)
m_lhs = alpha * inv(op(mwo_rhs1)) * op(mwo_rhs2) (right)
bool comp(const DVectorSlice &vs1, const DVectorSlice &vs2)
DenseLinAlgPack::DMatrixSlice DMatrixSlice
DenseLinAlgPack::DMatrix DMatrix
size_type cols(size_type rows, size_type cols, BLAS_Cpp::Transp _trans)
Return columns of a possible transposed matrix.
bool TestGenMatrixOp(std::ostream *out)
VectorSliceTmpl< value_type > rev()