66 #ifdef HAVE_TEUCHOS_COMPLEX
67 #define SType std::complex<double>
73 #define OType1 long int
84 #ifdef HAVE_TEUCHOS_COMPLEX
85 #define SCALARMAX SType(10,0)
87 #define SCALARMAX SType(10)
109 template<
typename TYPE>
121 std::complex<T>
GetRandom( std::complex<T>, std::complex<T> );
123 template<
typename TYPE,
typename OTYPE>
124 void PrintVector(TYPE* Vector,
OTYPE Size, std::string Name,
bool Matlab = 0);
126 template<
typename TYPE,
typename OTYPE>
129 template<
typename TYPE>
132 template<
typename TYPE,
typename OTYPE1,
typename OTYPE2>
135 template<
typename TYPE,
typename OTYPE1,
typename OTYPE2>
136 bool CompareMatrices(TYPE* Matrix1, OTYPE1 Rows1, OTYPE1 Columns1, OTYPE1 LDM1,
137 TYPE* Matrix2, OTYPE2 Rows2, OTYPE2 Columns2, OTYPE2 LDM2,
141 template<
typename OTYPE1,
typename OTYPE2>
144 return static_cast<OTYPE2
>(T1);
153 int main(
int argc,
char *argv[])
159 bool InvalidCmdLineArgs = 0;
163 for(i = 1; i < argc; i++)
165 if(argv[i][0] ==
'-')
176 InvalidCmdLineArgs = 1;
186 InvalidCmdLineArgs = 1;
196 InvalidCmdLineArgs = 1;
200 InvalidCmdLineArgs = 1;
209 if(InvalidCmdLineArgs || (argc > 4))
211 std::cout <<
"Invalid command line arguments detected. Use the following flags:" << std::endl
212 <<
"\t -v enables verbose mode (reports number of failed/successful tests)" << std::endl
213 <<
"\t -d enables debug mode (same as verbose with output of each test, not recommended for large numbers of tests)" << std::endl
214 <<
"\t -m enables matlab-style output; only has an effect if debug mode is enabled" << std::endl;
222 SType OType1alpha, OType1beta;
223 SType OType2alpha, OType2beta;
224 SType *OType1A, *OType1B, *OType1C, *OType1x, *OType1y;
225 SType *OType2A, *OType2B, *OType2C, *OType2x, *OType2y;
226 SType OType1ASUMresult, OType1DOTresult, OType1NRM2result, OType1SINresult;
227 SType OType2ASUMresult, OType2DOTresult, OType2NRM2result, OType2SINresult;
228 MType OType1COSresult, OType2COSresult;
233 OType1 TotalTestCount = 1, GoodTestSubcount, GoodTestCount = 0, M1, N1, P1, K1, LDA1, LDB1, LDC1, Mx1, My1;
234 OType2 M2, N2, P2, K2, LDA2, LDB2, LDC2, Mx2, My2;
241 std::srand(time(NULL));
248 GoodTestSubcount = 0;
252 OType2alpha = OType1alpha;
254 OType2beta = OType1beta;
256 OType2COSresult = OType1COSresult;
258 OType2SINresult = OType1SINresult;
262 std::cout <<
"Test #" << TotalTestCount <<
" -- ROTG -- " << std::endl;
263 std::cout <<
"OType1alpha = " << OType1alpha << std::endl;
264 std::cout <<
"OType2alpha = " << OType2alpha << std::endl;
265 std::cout <<
"OType1beta = " << OType1beta << std::endl;
266 std::cout <<
"OType2beta = " << OType2beta << std::endl;
269 OType1BLAS.
ROTG(&OType1alpha, &OType1beta, &OType1COSresult, &OType1SINresult);
270 OType2BLAS.
ROTG(&OType2alpha, &OType2beta, &OType2COSresult, &OType2SINresult);
273 std::cout <<
"OType1 ROTG COS result: " << OType1COSresult << std::endl;
274 std::cout <<
"OType2 ROTG COS result: " << OType2COSresult << std::endl;
275 std::cout <<
"OType1 ROTG SIN result: " << OType1SINresult << std::endl;
276 std::cout <<
"OType2 ROTG SIN result: " << OType2SINresult << std::endl;
279 std::cout <<
"FAILED TEST!!!!!!" << std::endl;
280 GoodTestSubcount += (
CompareScalars(OType1COSresult, OType2COSresult, TOL) &&
283 GoodTestCount += GoodTestSubcount;
284 if(verbose || debug) std::cout <<
"ROTG: " << GoodTestSubcount <<
" of " << ROTGTESTS <<
" tests were successful." << std::endl;
285 if(debug) std::cout << std::endl;
293 GoodTestSubcount = 0;
298 if (incx1 == 0) incx1 = 1;
299 if (incy1 == 0) incy1 = 1;
304 Mx1 = M1*std::abs(incx1);
305 My1 = M1*std::abs(incy1);
306 if (Mx1 == 0) { Mx1 = 1; }
307 if (My1 == 0) { My1 = 1; }
310 OType1x =
new SType[Mx1];
311 OType1y =
new SType[My1];
312 OType2x =
new SType[Mx2];
313 OType2y =
new SType[My2];
314 for(j1 = 0, j2 = 0; j1 < Mx1; j1++, j2++)
317 OType2x[j2] = OType1x[j1];
319 for(j1 = 0, j2 = 0; j1 < My1; j1++, j2++)
322 OType2y[j2] = OType1y[j1];
330 std::cout <<
"Test #" << TotalTestCount <<
" -- ROT -- " << std::endl;
331 std::cout <<
"c1 = " << c1 <<
", s1 = " << s1 << std::endl;
332 std::cout <<
"c2 = " << c2 <<
", s2 = " << s2 << std::endl;
333 std::cout <<
"incx1 = " << incx1 <<
", incy1 = " << incy1 << std::endl;
334 std::cout <<
"incx2 = " << incx2 <<
", incy2 = " << incy2 << std::endl;
336 PrintVector(OType1y, My1,
"OType1y_before_operation", matlab);
338 PrintVector(OType2y, My2,
"OType2y_before_operation", matlab);
341 OType1BLAS.
ROT(M1, OType1x, incx1, OType1y, incy1, &c1, &s1);
342 OType2BLAS.
ROT(M2, OType2x, incx2, OType2y, incy2, &c2, &s2);
345 PrintVector(OType1y, My1,
"OType1y_after_operation", matlab);
346 PrintVector(OType2y, My2,
"OType2y_after_operation", matlab);
349 std::cout <<
"FAILED TEST!!!!!!" << std::endl;
350 GoodTestSubcount += (
CompareVectors(OType1x, Mx1, OType2x, Mx2, TOL) &&
357 GoodTestCount += GoodTestSubcount;
358 if(verbose || debug) std::cout <<
"ROT: " << GoodTestSubcount <<
" of " << ROTTESTS <<
" tests were successful." << std::endl;
359 if(debug) std::cout << std::endl;
367 GoodTestSubcount = 0;
375 OType1x =
new SType[M1*incx1];
376 OType2x =
new SType[M2*incx2];
377 for(j1 = 0, j2 = 0; j2 < M2*incx2; j1++, j2++)
380 OType2x[j2] = OType1x[j1];
384 std::cout <<
"Test #" << TotalTestCount <<
" -- ASUM -- " << std::endl;
385 std::cout <<
"incx1 = " << incx1 <<
"\t" <<
"incx2 = " << incx2
386 <<
"\t" <<
"M1 = " << M1 <<
"\t" <<
"M2 = " << M2 << std::endl;
391 OType1ASUMresult = OType1BLAS.
ASUM(M1, OType1x, incx1);
392 OType2ASUMresult = OType2BLAS.
ASUM(M2, OType2x, incx2);
395 std::cout <<
"OType1 ASUM result: " << OType1ASUMresult << std::endl;
396 std::cout <<
"OType2 ASUM result: " << OType2ASUMresult << std::endl;
399 std::cout <<
"FAILED TEST!!!!!!" << std::endl;
400 GoodTestSubcount +=
CompareScalars(OType1ASUMresult, OType2ASUMresult, TOL);
405 GoodTestCount += GoodTestSubcount;
406 if(verbose || debug) std::cout <<
"ASUM: " << GoodTestSubcount <<
" of " << ASUMTESTS <<
" tests were successful." << std::endl;
407 if(debug) std::cout << std::endl;
416 GoodTestSubcount = 0;
425 Mx1 = M1*std::abs(incx1);
426 My1 = M1*std::abs(incy1);
427 if (Mx1 == 0) { Mx1 = 1; }
428 if (My1 == 0) { My1 = 1; }
431 OType1x =
new SType[Mx1];
432 OType1y =
new SType[My1];
433 OType2x =
new SType[Mx2];
434 OType2y =
new SType[My2];
435 for(j1 = 0, j2 = 0; j1 < Mx1; j1++, j2++)
438 OType2x[j2] = OType1x[j1];
440 for(j1 = 0, j2 = 0; j1 < My1; j1++, j2++)
443 OType2y[j2] = OType1y[j1];
446 OType2alpha = OType1alpha;
449 std::cout <<
"Test #" << TotalTestCount <<
" -- AXPY -- " << std::endl;
450 std::cout <<
"OType1alpha = " << OType1alpha << std::endl;
451 std::cout <<
"OType2alpha = " << OType2alpha << std::endl;
453 PrintVector(OType1y, My1,
"OType1y_before_operation", matlab);
455 PrintVector(OType2y, My2,
"OType2y_before_operation", matlab);
458 OType1BLAS.
AXPY(M1, OType1alpha, OType1x, incx1, OType1y, incy1);
459 OType2BLAS.
AXPY(M2, OType2alpha, OType2x, incx2, OType2y, incy2);
462 PrintVector(OType1y, My1,
"OType1y_after_operation", matlab);
463 PrintVector(OType2y, My2,
"OType2y_after_operation", matlab);
466 std::cout <<
"FAILED TEST!!!!!!" << std::endl;
467 GoodTestSubcount +=
CompareVectors(OType1y, My1, OType2y, My2, TOL);
474 GoodTestCount += GoodTestSubcount;
475 if(verbose || debug) std::cout <<
"AXPY: " << GoodTestSubcount <<
" of " << AXPYTESTS <<
" tests were successful." << std::endl;
476 if(debug) std::cout << std::endl;
484 GoodTestSubcount = 0;
493 Mx1 = M1*std::abs(incx1);
494 My1 = M1*std::abs(incy1);
495 if (Mx1 == 0) { Mx1 = 1; }
496 if (My1 == 0) { My1 = 1; }
499 OType1x =
new SType[Mx1];
500 OType1y =
new SType[My1];
501 OType2x =
new SType[Mx2];
502 OType2y =
new SType[My2];
503 for(j1 = 0, j2 = 0; j1 < Mx1; j1++, j2++)
506 OType2x[j2] = OType1x[j1];
508 for(j1 = 0, j2 = 0; j1 < My1; j1++, j2++)
511 OType2y[j2] = OType1y[j1];
515 std::cout <<
"Test #" << TotalTestCount <<
" -- COPY -- " << std::endl;
517 PrintVector(OType1y, My1,
"OType1y_before_operation", matlab);
519 PrintVector(OType2y, My2,
"OType2y_before_operation", matlab);
522 OType1BLAS.
COPY(M1, OType1x, incx1, OType1y, incy1);
523 OType2BLAS.
COPY(M2, OType2x, incx2, OType2y, incy2);
526 PrintVector(OType1y, My1,
"OType1y_after_operation", matlab);
527 PrintVector(OType2y, My2,
"OType2y_after_operation", matlab);
530 std::cout <<
"FAILED TEST!!!!!!" << std::endl;
531 GoodTestSubcount +=
CompareVectors(OType1y, My1, OType2y, My2, TOL);
538 GoodTestCount += GoodTestSubcount;
if(verbose || debug) std::cout <<
"COPY: " << GoodTestSubcount <<
" of " << COPYTESTS <<
" tests were successful." << std::endl;
539 if(debug) std::cout << std::endl;
547 GoodTestSubcount = 0;
556 Mx1 = M1*std::abs(incx1);
557 My1 = M1*std::abs(incy1);
558 if (Mx1 == 0) { Mx1 = 1; }
559 if (My1 == 0) { My1 = 1; }
562 OType1x =
new SType[Mx1];
563 OType1y =
new SType[My1];
564 OType2x =
new SType[Mx2];
565 OType2y =
new SType[My2];
566 for(j1 = 0, j2 = 0; j1 < Mx1; j1++, j2++)
569 OType2x[j2] = OType1x[j1];
571 for(j1 = 0, j2 = 0; j1 < My1; j1++, j2++)
574 OType2y[j2] = OType1y[j1];
578 std::cout <<
"Test #" << TotalTestCount <<
" -- DOT -- " << std::endl;
585 OType1DOTresult = OType1BLAS.
DOT(M1, OType1x, incx1, OType1y, incy1);
586 OType2DOTresult = OType2BLAS.
DOT(M2, OType2x, incx2, OType2y, incy2);
589 std::cout <<
"OType1 DOT result: " << OType1DOTresult << std::endl;
590 std::cout <<
"OType2 DOT result: " << OType2DOTresult << std::endl;
593 std::cout <<
"DOT test " << i+1 <<
" of " << DOTTESTS <<
" FAILED! "
595 <<
"The two results are " << OType1DOTresult <<
" and "
596 << OType2DOTresult <<
". incx1 = " << incx1 <<
", incy1 = "
597 << incy1 <<
", incx2 = " << incx2 <<
", and incy2 = "
598 << incy2 << std::endl;
601 GoodTestSubcount +=
CompareScalars(OType1DOTresult, OType2DOTresult, TOL);
608 GoodTestCount += GoodTestSubcount;
609 if(verbose || debug) std::cout <<
"DOT: " << GoodTestSubcount <<
" of " << DOTTESTS <<
" tests were successful." << std::endl;
610 if(debug) std::cout << std::endl;
618 GoodTestSubcount = 0;
625 OType1x =
new SType[M1*incx1];
626 OType2x =
new SType[M2*incx2];
627 for(j1 = 0, j2 = 0; j1 < M1*incx1; j1++, j2++)
630 OType2x[j2] = OType1x[j1];
634 std::cout <<
"Test #" << TotalTestCount <<
" -- NRM2 -- " << std::endl;
639 OType1NRM2result = OType1BLAS.
NRM2(M1, OType1x, incx1);
640 OType2NRM2result = OType2BLAS.
NRM2(M2, OType2x, incx2);
643 std::cout <<
"OType1 NRM2 result: " << OType1NRM2result << std::endl;
644 std::cout <<
"OType2 NRM2 result: " << OType2NRM2result << std::endl;
647 std::cout <<
"FAILED TEST!!!!!!" << std::endl;
648 GoodTestSubcount +=
CompareScalars(OType1NRM2result, OType2NRM2result, TOL);
653 GoodTestCount += GoodTestSubcount;
if(verbose || debug) std::cout <<
"NRM2: " << GoodTestSubcount <<
" of " << NRM2TESTS <<
" tests were successful." << std::endl;
654 if(debug) std::cout << std::endl;
662 GoodTestSubcount = 0;
672 OType1x =
new SType[M1*incx1];
673 OType2x =
new SType[M2*incx2];
674 for(j1 = 0, j2 = 0; j1 < M1*incx1; j1++, j2++)
677 OType2x[j2] = OType1x[j1];
680 OType2alpha = OType1alpha;
683 std::cout <<
"Test #" << TotalTestCount <<
" -- SCAL -- " << std::endl;
684 std::cout <<
"OType1alpha = " << OType1alpha << std::endl;
685 std::cout <<
"OType2alpha = " << OType2alpha << std::endl;
686 PrintVector(OType1x, M1*incx1,
"OType1x_before_operation", matlab);
687 PrintVector(OType2x, M2*incx2,
"OType2x_before_operation", matlab);
690 OType1BLAS.
SCAL(M1, OType1alpha, OType1x, incx1);
691 OType2BLAS.
SCAL(M2, OType2alpha, OType2x, incx2);
694 PrintVector(OType1x, M1*incx1,
"OType1x_after_operation", matlab);
695 PrintVector(OType2x, M2*incx2,
"OType2x_after_operation", matlab);
698 std::cout <<
"FAILED TEST!!!!!!" << std::endl;
699 GoodTestSubcount +=
CompareVectors(OType1x, M1*incx1, OType2x, M2*incx2, TOL);
704 GoodTestCount += GoodTestSubcount;
705 if(verbose || debug) std::cout <<
"SCAL: " << GoodTestSubcount <<
" of " << SCALTESTS <<
" tests were successful." << std::endl;
706 if(debug) std::cout << std::endl;
714 GoodTestSubcount = 0;
721 OType1x =
new SType[M1*incx1];
722 OType2x =
new SType[M2*incx2];
723 for(j1 = 0, j2 = 0; j1 < M1*incx1; j1++, j2++)
726 OType2x[j2] = OType1x[j1];
730 std::cout <<
"Test #" << TotalTestCount <<
" -- IAMAX -- " << std::endl;
735 OType1IAMAXresult = OType1BLAS.
IAMAX(M1, OType1x, incx1);
736 OType2IAMAXresult = OType2BLAS.
IAMAX(M2, OType2x, incx2);
739 std::cout <<
"OType1 IAMAX result: " << OType1IAMAXresult << std::endl;
740 std::cout <<
"OType2 IAMAX result: " << OType2IAMAXresult << std::endl;
742 if (OType1IAMAXresult != OType2IAMAXresult)
743 std::cout <<
"FAILED TEST!!!!!!" << std::endl;
744 GoodTestSubcount += (OType1IAMAXresult == OType2IAMAXresult);
749 GoodTestCount += GoodTestSubcount;
750 if(verbose || debug) std::cout <<
"IAMAX: " << GoodTestSubcount <<
" of " << IAMAXTESTS <<
" tests were successful." << std::endl;
751 if(debug) std::cout << std::endl;
761 GoodTestSubcount = 0;
782 OType1 M2_1 = 0, N2_1 = 0;
784 M2_1 = M1*std::abs(incy1);
785 N2_1 = N1*std::abs(incx1);
787 M2_1 = N1*std::abs(incy1);
788 N2_1 = M1*std::abs(incx1);
803 OType2alpha = OType1alpha;
804 OType2beta = OType1beta;
806 OType1A =
new SType[LDA1 * N1];
807 OType1x =
new SType[N2_1];
808 OType1y =
new SType[M2_1];
809 OType2A =
new SType[LDA2 * N2];
810 OType2x =
new SType[N2_2];
811 OType2y =
new SType[M2_2];
813 for(j1 = 0, j2 = 0; j1 < LDA1 * N1; j1++, j2++)
816 OType2A[j2] = OType1A[j1];
818 for(j1 = 0, j2 = 0; j1 < N2_1; j1++, j2++)
821 OType2x[j2] = OType1x[j1];
823 for(j1 = 0, j2 = 0; j1 < M2_1; j1++, j2++)
826 OType2y[j2] = OType1y[j1];
830 std::cout <<
"Test #" << TotalTestCount <<
" -- GEMV -- " << std::endl;
832 std::cout <<
"OType1alpha = " << OType1alpha << std::endl;
833 std::cout <<
"OType2alpha = " << OType2alpha << std::endl;
834 std::cout <<
"OType1beta = " << OType1beta << std::endl;
835 std::cout <<
"OType2beta = " << OType2beta << std::endl;
836 PrintMatrix(OType1A, M1, N1, LDA1,
"OType1A", matlab);
838 PrintVector(OType1y, M2_1,
"OType1y_before_operation", matlab);
839 PrintMatrix(OType2A, M2, N2, LDA2,
"OType2A", matlab);
841 PrintVector(OType2y, M2_2,
"OType2y_before_operation", matlab);
844 OType1BLAS.
GEMV(TRANS, M1, N1, OType1alpha, OType1A, LDA1, OType1x, incx1, OType1beta, OType1y, incy1);
845 OType2BLAS.
GEMV(TRANS, M2, N2, OType2alpha, OType2A, LDA2, OType2x, incx2, OType2beta, OType2y, incy2);
848 PrintVector(OType1y, M2_1,
"OType1y_after_operation", matlab);
849 PrintVector(OType2y, M2_2,
"OType2y_after_operation", matlab);
852 std::cout <<
"FAILED TEST!!!!!!" << std::endl;
853 GoodTestSubcount +=
CompareVectors(OType1y, M2_1, OType2y, M2_2, TOL);
862 GoodTestCount += GoodTestSubcount;
863 if(verbose || debug) std::cout <<
"GEMV: " << GoodTestSubcount <<
" of " << GEMVTESTS <<
" tests were successful." << std::endl;
864 if(debug) std::cout << std::endl;
872 GoodTestSubcount = 0;
890 OType1x =
new SType[N1*std::abs(incx1)];
891 OType2x =
new SType[N2*std::abs(incx2)];
893 for(j1 = 0, j2 = 0; j1 < N1*std::abs(incx1); j1++, j2++)
896 OType2x[j2] = OType1x[j1];
904 OType1A =
new SType[LDA1 * N1];
905 OType2A =
new SType[LDA2 * N2];
907 for(j1 = 0, j2 = 0; j1 < N1; j1++, j2++)
912 for(k1 = 0, k2 = 0; k1 < N1; k1++, k2++)
917 OType1A[j1*LDA1+k1] = STypezero;
919 OType2A[j2*LDA2+k2] = OType1A[j1*LDA1+k1];
923 while (OType1A[j1*LDA1+k1] == STypezero) {
926 OType2A[j2*LDA2+k2] = OType1A[j1*LDA1+k1];
928 OType1A[j1*LDA1+k1] = STypeone;
929 OType2A[j2*LDA2+k2] = STypeone;
936 for(k1 = 0, k2 = 0; k1 < N1; k1++, k2++)
941 OType1A[j1*LDA1+k1] = STypezero;
943 OType2A[j2*LDA2+k2] = OType1A[j1*LDA1+k1];
947 while (OType1A[j1*LDA1+k1] == STypezero) {
950 OType2A[j2*LDA2+k2] = OType1A[j1*LDA1+k1];
952 OType1A[j1*LDA1+k1] = STypeone;
953 OType2A[j2*LDA2+k2] = STypeone;
962 std::cout <<
"Test #" << TotalTestCount <<
" -- TRMV -- " << std::endl;
966 PrintMatrix(OType1A, N1, N1, LDA1,
"OType1A", matlab);
967 PrintVector(OType1x, N1*incx1,
"OType1x_before_operation", matlab);
968 PrintMatrix(OType2A, N2, N2, LDA2,
"OType2A", matlab);
969 PrintVector(OType2x, N2*incx2,
"OType2x_before_operation", matlab);
972 OType1BLAS.
TRMV(UPLO, TRANSA, DIAG, N1, OType1A, LDA1, OType1x, incx1);
973 OType2BLAS.
TRMV(UPLO, TRANSA, DIAG, N2, OType2A, LDA2, OType2x, incx2);
976 PrintVector(OType1x, N1*incx1,
"OType1x_after_operation", matlab);
977 PrintVector(OType2x, N2*incx2,
"OType2x_after_operation", matlab);
979 if (
CompareVectors(OType1x, std::abs(N1*incx1), OType2x, std::abs(N2*incx2), TOL)==0)
980 std::cout <<
"FAILED TEST!!!!!!" << std::endl;
981 GoodTestSubcount +=
CompareVectors(OType1x, std::abs(N1*incx1), OType2x, std::abs(N2*incx2), TOL);
988 GoodTestCount += GoodTestSubcount;
989 if(verbose || debug) std::cout <<
"TRMV: " << GoodTestSubcount <<
" of " << TRMVTESTS <<
" tests were successful." << std::endl;
990 if(debug) std::cout << std::endl;
998 GoodTestSubcount = 0;
1002 while (incx1 == 0) {
1006 while (incy1 == 0) {
1022 OType1A =
new SType[LDA1 * N1];
1023 OType1x =
new SType[M1*std::abs(incx1)];
1024 OType1y =
new SType[N1*std::abs(incy1)];
1025 OType2A =
new SType[LDA2 * N2];
1026 OType2x =
new SType[M2*std::abs(incx2)];
1027 OType2y =
new SType[N2*std::abs(incy2)];
1029 OType2alpha = OType1alpha;
1030 for(j1 = 0, j2 = 0; j1 < LDA1 * N1; j1++, j2++)
1033 OType2A[j2] = OType1A[j1];
1035 for(j1 = 0, j2 = 0; j1 < std::abs(M1*incx1); j1++, j2++)
1038 OType2x[j2] = OType1x[j1];
1040 for(j1 = 0, j2 = 0; j1 < std::abs(N1*incy1); j1++, j2++)
1043 OType2y[j2] = OType1y[j1];
1047 std::cout <<
"Test #" << TotalTestCount <<
" -- GER -- " << std::endl;
1048 std::cout <<
"OType1alpha = " << OType1alpha << std::endl;
1049 std::cout <<
"OType2alpha = " << OType2alpha << std::endl;
1050 PrintMatrix(OType1A, M1, N1, LDA1,
"OType1A_before_operation", matlab);
1051 PrintVector(OType1x, std::abs(M1*incx1),
"OType1x", matlab);
1052 PrintVector(OType1y, std::abs(N1*incy1),
"OType1y", matlab);
1053 PrintMatrix(OType2A, M2, N2, LDA2,
"OType2A_before_operation", matlab);
1054 PrintVector(OType2x, std::abs(M2*incx2),
"OType2x", matlab);
1055 PrintVector(OType2y, std::abs(N2*incy2),
"OType2y", matlab);
1058 OType1BLAS.
GER(M1, N1, OType1alpha, OType1x, incx1, OType1y, incy1, OType1A, LDA1);
1059 OType2BLAS.
GER(M2, N2, OType2alpha, OType2x, incx2, OType2y, incy2, OType2A, LDA2);
1062 PrintMatrix(OType1A, M1, N1, LDA1,
"OType1A_after_operation", matlab);
1063 PrintMatrix(OType2A, M2, N2, LDA2,
"OType2A_after_operation", matlab);
1065 if (
CompareMatrices(OType1A, M1, N1, LDA1, OType2A, M2, N2, LDA2, TOL)==0)
1066 std::cout <<
"FAILED TEST!!!!!!" << std::endl;
1067 GoodTestSubcount +=
CompareMatrices(OType1A, M1, N1, LDA1, OType2A, M2, N2, LDA2, TOL);
1076 GoodTestCount += GoodTestSubcount;
1077 if(verbose || debug) std::cout <<
"GER: " << GoodTestSubcount <<
" of " << GERTESTS <<
" tests were successful." << std::endl;
1078 if(debug) std::cout << std::endl;
1088 GoodTestSubcount = 0;
1101 std::cout <<
"Test #" << TotalTestCount <<
" -- GEMM -- " << std::endl;
1109 OType1A =
new SType[LDA1 * P1];
1110 OType2A =
new SType[LDA2 * P2];
1111 for(j1 = 0, j2 = 0; j1 < LDA1 * P1; j1++, j2++)
1114 OType2A[j2] = OType1A[j1];
1117 PrintMatrix(OType1A, M1, P1, LDA1,
"OType1A", matlab);
1118 PrintMatrix(OType2A, M2, P2, LDA2,
"OType2A", matlab);
1123 OType1A =
new SType[LDA1 * M1];
1124 OType2A =
new SType[LDA1 * M1];
1125 for(j1 = 0, j2 = 0; j1 < LDA1 * M1; j1++, j2++)
1128 OType2A[j2] = OType1A[j1];
1131 PrintMatrix(OType1A, P1, M1, LDA1,
"OType1A", matlab);
1132 PrintMatrix(OType2A, P2, M2, LDA2,
"OType2A", matlab);
1140 OType1B =
new SType[LDB1 * N1];
1141 OType2B =
new SType[LDB2 * N2];
1142 for(j1 = 0, j2 = 0; j1 < LDB1 * N1; j1++, j2++)
1145 OType2B[j2] = OType1B[j1];
1148 PrintMatrix(OType1B, P1, N1, LDB1,
"OType1B", matlab);
1149 PrintMatrix(OType2B, P2, N2, LDB2,
"OType2B", matlab);
1154 OType1B =
new SType[LDB1 * P1];
1155 OType2B =
new SType[LDB2 * P2];
1156 for(j1 = 0, j2 = 0; j1 < LDB1 * P1; j1++, j2++)
1159 OType2B[j2] = OType1B[j1];
1162 PrintMatrix(OType1B, N1, P1, LDB1,
"OType1B", matlab);
1163 PrintMatrix(OType2B, N2, P2, LDB2,
"OType2B", matlab);
1170 OType1C =
new SType[LDC1 * N1];
1171 OType2C =
new SType[LDC2 * N2];
1172 for(j1 = 0, j2 = 0; j1 < LDC1 * N1; j1++, j2++) {
1174 OType2C[j2] = OType1C[j1];
1178 PrintMatrix(OType1C, M1, N1, LDC1,
"OType1C_before_operation", matlab);
1179 PrintMatrix(OType2C, M2, N2, LDC2,
"OType2C_before_operation", matlab);
1184 OType2alpha = OType1alpha;
1185 OType2beta = OType1beta;
1188 OType1BLAS.
GEMM(TRANSA, TRANSB, M1, N1, P1, OType1alpha, OType1A, LDA1, OType1B, LDB1, OType1beta, OType1C, LDC1);
1189 OType2BLAS.
GEMM(TRANSA, TRANSB, M2, N2, P2, OType2alpha, OType2A, LDA2, OType2B, LDB2, OType2beta, OType2C, LDC2);
1192 std::cout <<
"M1="<<M1 <<
"\t" <<
"N1="<<N1 <<
"\t" <<
"P1 = " << P1
1193 <<
"\t" <<
"LDA1="<<LDA1 <<
"\t" <<
"LDB1="<<LDB1 <<
"\t" <<
"LDC1=" << LDC1 << std::endl;
1194 std::cout <<
"M2="<<M2 <<
"\t" <<
"N2="<<N2 <<
"\t" <<
"P2 = " << P2
1195 <<
"\t" <<
"LDA2="<<LDA2 <<
"\t" <<
"LDB2="<<LDB2 <<
"\t" <<
"LDC2=" << LDC2 << std::endl;
1196 std::cout <<
"OType1alpha = " << OType1alpha << std::endl;
1197 std::cout <<
"OType2alpha = " << OType2alpha << std::endl;
1198 std::cout <<
"OType1beta = " << OType1beta << std::endl;
1199 std::cout <<
"OType2beta = " << OType2beta << std::endl;
1200 PrintMatrix(OType1C, M1, N1, LDC1,
"OType1C_after_operation", matlab);
1201 PrintMatrix(OType2C, M2, N2, LDC2,
"OType2C_after_operation", matlab);
1203 if (
CompareMatrices(OType1C, M1, N1, LDC1, OType2C, M2, N2, LDC2, TOL)==0)
1204 std::cout <<
"FAILED TEST!!!!!!" << std::endl;
1205 GoodTestSubcount +=
CompareMatrices(OType1C, M1, N1, LDC1, OType2C, M2, N2, LDC2, TOL);
1214 GoodTestCount += GoodTestSubcount;
1215 if(verbose || debug) std::cout <<
"GEMM: " << GoodTestSubcount <<
" of " << GEMMTESTS <<
" tests were successful." << std::endl;
1216 if(debug) std::cout << std::endl;
1224 GoodTestSubcount = 0;
1238 OType1A =
new SType[LDA1 * M1];
1239 OType2A =
new SType[LDA2 * M2];
1240 for(j1 = 0, j2 = 0; j1 < LDA1 * M1; j1++, j2++) {
1242 OType2A[j2] = OType1A[j1];
1247 OType1A =
new SType[LDA1 * N1];
1248 OType2A =
new SType[LDA2 * N2];
1249 for(j1 = 0, j2 = 0; j1 < LDA1 * N1; j1++, j2++) {
1251 OType2A[j2] = OType1A[j1];
1258 OType1B =
new SType[LDB1 * N1];
1259 OType2B =
new SType[LDB2 * N2];
1260 for(j1 = 0, j2 = 0; j1 < LDB1 * N1; j1++, j2++) {
1262 OType2B[j2] = OType1B[j1];
1268 OType1C =
new SType[LDC1 * N1];
1269 OType2C =
new SType[LDC2 * N2];
1270 for(j1 = 0, j2 = 0; j1 < LDC1 * N1; j1++, j2++) {
1272 OType2C[j2] = OType1C[j1];
1277 OType2alpha = OType1alpha;
1278 OType2beta = OType1beta;
1281 std::cout <<
"Test #" << TotalTestCount <<
" -- SYMM -- " << std::endl;
1284 std::cout <<
"OType1alpha = " << OType1alpha << std::endl;
1285 std::cout <<
"OType2alpha = " << OType2alpha << std::endl;
1286 std::cout <<
"OType1beta = " << OType1beta << std::endl;
1287 std::cout <<
"OType2beta = " << OType2beta << std::endl;
1289 PrintMatrix(OType1A, M1, M1, LDA1,
"OType1A", matlab);
1290 PrintMatrix(OType2A, M2, M2, LDA2,
"OType2A", matlab);
1292 PrintMatrix(OType1A, N1, N1, LDA1,
"OType1A", matlab);
1293 PrintMatrix(OType2A, N2, N2, LDA2,
"OType2A", matlab);
1295 PrintMatrix(OType1B, M1, N1, LDB1,
"OType1B", matlab);
1296 PrintMatrix(OType1C, M1, N1, LDC1,
"OType1C_before_operation", matlab);
1297 PrintMatrix(OType2B, M2, N2, LDB2,
"OType2B", matlab);
1298 PrintMatrix(OType2C, M2, N2, LDC2,
"OType2C_before_operation", matlab);
1302 OType1BLAS.
SYMM(SIDE, UPLO, M1, N1, OType1alpha, OType1A, LDA1, OType1B, LDB1, OType1beta, OType1C, LDC1);
1303 OType2BLAS.
SYMM(SIDE, UPLO, M2, N2, OType2alpha, OType2A, LDA2, OType2B, LDB2, OType2beta, OType2C, LDC2);
1306 PrintMatrix(OType1C, M1, N1, LDC1,
"OType1C_after_operation", matlab);
1307 PrintMatrix(OType2C, M2, N2, LDC2,
"OType2C_after_operation", matlab);
1309 if (
CompareMatrices(OType1C, M1, N1, LDC1, OType2C, M2, N2, LDC2, TOL)==0)
1310 std::cout <<
"FAILED TEST!!!!!!" << std::endl;
1311 GoodTestSubcount +=
CompareMatrices(OType1C, M1, N1, LDC1, OType2C, M2, N2, LDC2, TOL);
1320 GoodTestCount += GoodTestSubcount;
1321 if(verbose || debug) std::cout <<
"SYMM: " << GoodTestSubcount <<
" of " << SYMMTESTS <<
" tests were successful." << std::endl;
1322 if(debug) std::cout << std::endl;
1330 GoodTestSubcount = 0;
1341 #ifdef HAVE_TEUCHOS_COMPLEX
1349 OType1A =
new SType[LDA1 * K1];
1350 OType2A =
new SType[LDA2 * K2];
1351 for(j1 = 0, j2 = 0; j1 < LDA1 * K1; j1++, j2++) {
1353 OType2A[j2] = OType1A[j1];
1358 OType1A =
new SType[LDA1 * N1];
1359 OType2A =
new SType[LDA2 * N2];
1360 for(j1 = 0, j2 = 0; j1 < LDA1 * N1; j1++, j2++) {
1362 OType2A[j2] = OType1A[j1];
1369 OType1C =
new SType[LDC1 * N1];
1370 OType2C =
new SType[LDC2 * N2];
1371 for(j1 = 0, j2 = 0; j1 < N1; j1++, j2++) {
1376 for(k1 = 0, k2 = 0; k1 < N1; k1++, k2++)
1381 OType1C[j1*LDC1+k1] = STypezero;
1383 OType2C[j2*LDC2+k2] = OType1C[j1*LDC1+k1];
1387 for(k1 = 0, k2 = 0; k1 < N1; k1++, k2++)
1392 OType1C[j1*LDC1+k1] = STypezero;
1394 OType2C[j2*LDC2+k2] = OType1C[j1*LDC1+k1];
1401 OType2alpha = OType1alpha;
1402 OType2beta = OType1beta;
1405 std::cout <<
"Test #" << TotalTestCount <<
" -- SYRK -- " << std::endl;
1408 std::cout <<
"N1="<<N1 <<
"\t" <<
"K1 = " << K1
1409 <<
"\t" <<
"LDA1="<<LDA1 <<
"\t" <<
"LDC1=" << LDC1 << std::endl;
1410 std::cout <<
"N2="<<N2 <<
"\t" <<
"K2 = " << K2
1411 <<
"\t" <<
"LDA2="<<LDA2 <<
"\t" <<
"LDC2=" << LDC2 << std::endl;
1412 std::cout <<
"OType1alpha = " << OType1alpha << std::endl;
1413 std::cout <<
"OType2alpha = " << OType2alpha << std::endl;
1414 std::cout <<
"OType1beta = " << OType1beta << std::endl;
1415 std::cout <<
"OType2beta = " << OType2beta << std::endl;
1417 PrintMatrix(OType1A, N1, K1, LDA1,
"OType1A", matlab);
1418 PrintMatrix(OType2A, N2, K2, LDA2,
"OType2A", matlab);
1420 PrintMatrix(OType1A, K1, N1, LDA1,
"OType1A", matlab);
1421 PrintMatrix(OType2A, K2, N2, LDA2,
"OType2A", matlab);
1423 PrintMatrix(OType1C, N1, N1, LDC1,
"OType1C_before_operation", matlab);
1424 PrintMatrix(OType2C, N2, N2, LDC2,
"OType2C_before_operation", matlab);
1428 OType1BLAS.
SYRK(UPLO, TRANS, N1, K1, OType1alpha, OType1A, LDA1, OType1beta, OType1C, LDC1);
1429 OType2BLAS.
SYRK(UPLO, TRANS, N2, K2, OType2alpha, OType2A, LDA2, OType2beta, OType2C, LDC2);
1432 PrintMatrix(OType1C, N1, N1, LDC1,
"OType1C_after_operation", matlab);
1433 PrintMatrix(OType2C, N2, N2, LDC2,
"OType2C_after_operation", matlab);
1435 if (
CompareMatrices(OType1C, N1, N1, LDC1, OType2C, N2, N2, LDC2, TOL)==0)
1436 std::cout <<
"FAILED TEST!!!!!!" << std::endl;
1437 GoodTestSubcount +=
CompareMatrices(OType1C, N1, N1, LDC1, OType2C, N2, N2, LDC2, TOL);
1444 GoodTestCount += GoodTestSubcount;
1445 if(verbose || debug) std::cout <<
"SYRK: " << GoodTestSubcount <<
" of " << SYRKTESTS <<
" tests were successful." << std::endl;
1446 if(debug) std::cout << std::endl;
1454 GoodTestSubcount = 0;
1468 OType1B =
new SType[LDB1 * N1];
1469 OType2B =
new SType[LDB2 * N2];
1484 OType1A =
new SType[LDA1 * M1];
1485 OType2A =
new SType[LDA2 * M2];
1487 for(j1 = 0, j2 = 0; j1 < M1; j1++, j2++)
1492 for(k1 = 0, k2 = 0; k1 < M1; k1++, k2++)
1497 OType1A[j1*LDA1+k1] = STypezero;
1499 OType2A[j2*LDA2+k2] = OType1A[j1*LDA1+k1];
1503 while (OType1A[j1*LDA1+k1] == STypezero) {
1506 OType2A[j2*LDA2+k2] = OType1A[j1*LDA1+k1];
1508 OType1A[j1*LDA1+k1] = STypeone;
1509 OType2A[j2*LDA2+k2] = STypeone;
1516 for(k1 = 0, k2 = 0; k1 < M1; k1++, k2++)
1521 OType1A[j1*LDA1+k1] = STypezero;
1523 OType2A[j2*LDA2+k2] = OType1A[j1*LDA1+k1];
1527 while (OType1A[j1*LDA1+k1] == STypezero) {
1530 OType2A[j2*LDA2+k2] = OType1A[j1*LDA1+k1];
1532 OType1A[j1*LDA1+k1] = STypeone;
1533 OType2A[j2*LDA2+k2] = STypeone;
1548 OType1A =
new SType[LDA1 * N1];
1549 OType2A =
new SType[LDA2 * N2];
1551 for(j1 = 0, j2 = 0; j1 < N1; j1++, j2++)
1556 for(k1 = 0, k2 = 0; k1 < N1; k1++, k2++)
1561 OType1A[j1*LDA1+k1] = STypezero;
1563 OType2A[j1*LDA1+k1] = OType1A[j1*LDA1+k1];
1567 while (OType1A[j1*LDA1+k1] == STypezero) {
1570 OType2A[j2*LDA2+k2] = OType1A[j1*LDA1+k1];
1572 OType1A[j1*LDA1+k1] = STypeone;
1573 OType2A[j2*LDA2+k2] = STypeone;
1580 for(k1 = 0, k2 = 0; k1 < N1; k1++, k2++)
1585 OType1A[j1*LDA1+k1] = STypezero;
1587 OType2A[j2*LDA2+k2] = OType1A[j1*LDA1+k1];
1591 while (OType1A[j1*LDA1+k1] == STypezero) {
1594 OType2A[j2*LDA2+k2] = OType1A[j1*LDA1+k1];
1596 OType1A[j1*LDA1+k1] = STypeone;
1597 OType2A[j2*LDA2+k2] = STypeone;
1606 for(j1 = 0, j2 = 0; j1 < N1; j1++, j2++) {
1607 for(k1 = 0, k2 = 0; k1 < M1; k1++, k2++) {
1609 OType2B[j2*LDB2+k2] = OType1B[j1*LDB1+k1];
1613 OType2alpha = OType1alpha;
1616 std::cout <<
"Test #" << TotalTestCount <<
" -- TRMM -- " << std::endl;
1621 std::cout <<
"OType1alpha = " << OType1alpha << std::endl;
1622 std::cout <<
"OType2alpha = " << OType2alpha << std::endl;
1624 PrintMatrix(OType1A, M1, M1, LDA1,
"OType1A", matlab);
1625 PrintMatrix(OType2A, M2, M2, LDA2,
"OType2A", matlab);
1627 PrintMatrix(OType1A, N1, N1, LDA1,
"OType1A", matlab);
1628 PrintMatrix(OType2A, N2, N2, LDA2,
"OType2A", matlab);
1630 PrintMatrix(OType1B, M1, N1, LDB1,
"OType1B_before_operation", matlab);
1631 PrintMatrix(OType2B, M2, N2, LDB2,
"OType2B_before_operation", matlab);
1634 OType1BLAS.
TRMM(SIDE, UPLO, TRANSA, DIAG, M1, N1, OType1alpha, OType1A, LDA1, OType1B, LDB1);
1635 OType2BLAS.
TRMM(SIDE, UPLO, TRANSA, DIAG, M2, N2, OType2alpha, OType2A, LDA2, OType2B, LDB2);
1638 PrintMatrix(OType1B, M1, N1, LDB1,
"OType1B_after_operation", matlab);
1639 PrintMatrix(OType2B, M2, N2, LDB2,
"OType2B_after_operation", matlab);
1641 if (
CompareMatrices(OType1B, M1, N1, LDB1, OType2B, M2, N2, LDB2, TOL)==0)
1642 std::cout <<
"FAILED TEST!!!!!!" << std::endl;
1643 GoodTestSubcount +=
CompareMatrices(OType1B, M1, N1, LDB1, OType2B, M2, N2, LDB2, TOL);
1649 GoodTestCount += GoodTestSubcount;
1650 if(verbose || debug) std::cout <<
"TRMM: " << GoodTestSubcount <<
" of " << TRMMTESTS <<
" tests were successful." << std::endl;
1651 if(debug) std::cout << std::endl;
1659 GoodTestSubcount = 0;
1673 OType1B =
new SType[LDB1 * N1];
1674 OType2B =
new SType[LDB2 * N2];
1692 OType1A =
new SType[LDA1 * M1];
1693 OType2A =
new SType[LDA2 * M2];
1695 for(j1 = 0, j2 = 0; j1 < M1; j1++, j2++)
1700 for(k1 = 0, k2 = 0; k1 < M1; k1++, k2++)
1705 OType1A[j1*LDA1+k1] = STypezero;
1707 OType2A[j2*LDA2+k2] = OType1A[j1*LDA1+k1];
1711 while (OType1A[j1*LDA1+k1] == STypezero) {
1714 OType2A[j2*LDA2+k2] = OType1A[j1*LDA1+k1];
1716 OType1A[j1*LDA1+k1] = STypeone;
1717 OType2A[j2*LDA2+k2] = STypeone;
1724 for(k1 = 0, k2 = 0; k1 < M1; k1++, k2++)
1729 OType1A[j1*LDA1+k1] = STypezero;
1731 OType2A[j2*LDA2+k2] = OType1A[j1*LDA1+k1];
1735 while (OType1A[j1*LDA1+k1] == STypezero) {
1738 OType2A[j2*LDA2+k2] = OType1A[j1*LDA1+k1];
1740 OType1A[j1*LDA1+k1] = STypeone;
1741 OType2A[j2*LDA2+k2] = STypeone;
1756 OType1A =
new SType[LDA1 * N1];
1757 OType2A =
new SType[LDA2 * N2];
1759 for(j1 = 0, j2 = 0; j1 < N1; j1++, j2++)
1764 for(k1 = 0, k2 = 0; k1 < N1; k1++, k2++)
1769 OType1A[j1*LDA1+k1] = STypezero;
1771 OType2A[j2*LDA2+k2] = OType1A[j1*LDA1+k1];
1775 while (OType1A[j1*LDA1+k1] == STypezero) {
1778 OType2A[j2*LDA2+k2] = OType1A[j1*LDA1+k1];
1780 OType1A[j1*LDA1+k1] = STypeone;
1781 OType2A[j2*LDA2+k2] = STypeone;
1788 for(k1 = 0, k2 = 0; k1 < N1; k1++, k2++)
1793 OType1A[j1*LDA1+k1] = STypezero;
1795 OType2A[j2*LDA2+k2] = OType1A[j1*LDA1+k1];
1799 while (OType1A[j1*LDA1+k1] == STypezero) {
1802 OType2A[j2*LDA2+k2] = OType1A[j1*LDA1+k1];
1804 OType1A[j1*LDA1+k1] = STypeone;
1805 OType2A[j2*LDA2+k2] = STypeone;
1814 for(j1 = 0, j2 = 0; j1 < N1; j1++, j2++)
1816 for(k1 = 0, k2 = 0; k1 < M1; k1++, k2++)
1819 OType2B[j2*LDB2+k2] = OType1B[j1*LDB1+k1];
1824 OType2alpha = OType1alpha;
1828 std::cout <<
"Test #" << TotalTestCount <<
" -- TRSM -- " << std::endl;
1833 std::cout <<
"M1="<<M1 <<
"\t" <<
"N1="<<N1 <<
"\t" <<
"LDA1="<<LDA1 <<
"\t" <<
"LDB1="<<LDB1 << std::endl;
1834 std::cout <<
"M2="<<M2 <<
"\t" <<
"N2="<<N2 <<
"\t" <<
"LDA2="<<LDA2 <<
"\t" <<
"LDB2="<<LDB2 << std::endl;
1835 std::cout <<
"OType1alpha = " << OType1alpha << std::endl;
1836 std::cout <<
"OType2alpha = " << OType2alpha << std::endl;
1838 PrintMatrix(OType1A, M1, M1, LDA1,
"OType1A", matlab);
1839 PrintMatrix(OType2A, M2, M2, LDA2,
"OType2A", matlab);
1841 PrintMatrix(OType1A, N1, N1, LDA1,
"OType1A", matlab);
1842 PrintMatrix(OType2A, N2, N2, LDA2,
"OType2A", matlab);
1844 PrintMatrix(OType1B, M1, N1, LDB1,
"OType1B_before_operation", matlab);
1845 PrintMatrix(OType2B, M2, N2, LDB2,
"OType2B_before_operation", matlab);
1849 OType1BLAS.
TRSM(SIDE, UPLO, TRANSA, DIAG, M1, N1, OType1alpha, OType1A, LDA1, OType1B, LDB1);
1850 OType2BLAS.
TRSM(SIDE, UPLO, TRANSA, DIAG, M2, N2, OType2alpha, OType2A, LDA2, OType2B, LDB2);
1854 PrintMatrix(OType1B, M1, N1, LDB1,
"OType1B_after_operation", matlab);
1855 PrintMatrix(OType2B, M2, N2, LDB2,
"OType2B_after_operation", matlab);
1858 if (
CompareMatrices(OType1B, M1, N1, LDB1, OType2B, M2, N2, LDB2, TOL)==0)
1859 std::cout <<
"FAILED TEST!!!!!!" << std::endl;
1860 GoodTestSubcount +=
CompareMatrices(OType1B, M1, N1, LDB1, OType2B, M2, N2, LDB2, TOL);
1867 GoodTestCount += GoodTestSubcount;
1868 if(verbose || debug) std::cout <<
"TRSM: " << GoodTestSubcount <<
" of " << TRSMTESTS <<
" tests were successful." << std::endl;
1869 if(debug) std::cout << std::endl;
1874 if((((TotalTestCount - 1) - GoodTestCount) != 0) || (verbose) || (debug))
1876 std::cout << GoodTestCount <<
" of " << (TotalTestCount - 1) <<
" total tests were successful." << std::endl;
1879 if ((TotalTestCount-1) == GoodTestCount) {
1880 std::cout <<
"End Result: TEST PASSED" << std::endl;
1884 std::cout <<
"End Result: TEST FAILED" << std::endl;
1885 return (TotalTestCount-GoodTestCount-1);
1888 template<
typename TYPE>
1894 template<
typename T>
1895 std::complex<T>
GetRandom( std::complex<T> Low, std::complex<T> High)
1897 T lowMag = Low.real();
1898 T highMag = High.real();
1901 return std::complex<T>( real, imag );
1911 double GetRandom(
double Low,
double High)
1916 template<
typename TYPE,
typename OTYPE>
1919 std::cout << Name <<
" =" << std::endl;
1921 if(Matlab) std::cout <<
"[";
1922 for(i = 0; i < Size; i++)
1924 std::cout << Vector[i] <<
" ";
1926 if(Matlab) std::cout <<
"]";
1929 std::cout << std::endl << std::endl;
1933 std::cout <<
";" << std::endl;
1937 template<
typename TYPE,
typename OTYPE>
1942 std::cout << Name <<
" =" << std::endl;
1944 for(i = 0; i < Rows; i++)
1946 for(j = 0; j < Columns; j++)
1948 std::cout << Matrix[i + (j * LDM)] <<
" ";
1950 std::cout << std::endl;
1952 std::cout << std::endl;
1956 std::cout << Name <<
" = ";
1959 for(i = 0; i < Rows; i++)
1962 for(j = 0; j < Columns; j++)
1964 std::cout << Matrix[i + (j * LDM)] <<
" ";
1968 std::cout <<
"];" << std::endl;
1972 template<
typename TYPE>
1980 return( temp2 < Tolerance );
1987 template<
typename TYPE,
typename OTYPE1,
typename OTYPE2>
1997 for(i1 = 0, i2 = 0; i1 < Size1; i1++, i2++)
2000 temp = Vector1[i1] - Vector2[i2];
2008 if (temp3 > Tolerance )
2017 template<
typename TYPE,
typename OTYPE1,
typename OTYPE2>
2019 TYPE* Matrix2, OTYPE2 Rows2, OTYPE2 Columns2, OTYPE2 LDM2,
2029 for(j1 = 0, j2 = 0; j1 < Columns1; j1++, j2++)
2031 for(i1 = 0, i2 = 0; i1 < Rows1; i1++, i2++)
2034 temp = Matrix1[j1*LDM1 + i1] - Matrix2[j2*LDM2 + i2];
2043 if (temp3 > Tolerance)
2084 if(r == 1 || r == 2)
void TRSM(ESide side, EUplo uplo, ETransp transa, EDiag diag, const OrdinalType &m, const OrdinalType &n, const alpha_type alpha, const A_type *A, const OrdinalType &lda, ScalarType *B, const OrdinalType &ldb) const
Solves the matrix equations: op(A)*X=alpha*B or X*op(A)=alpha*B where X and B are m by n matrices...
void GER(const OrdinalType &m, const OrdinalType &n, const alpha_type alpha, const x_type *x, const OrdinalType &incx, const y_type *y, const OrdinalType &incy, ScalarType *A, const OrdinalType &lda) const
Performs the rank 1 operation: A <- alpha*x*y'+A.
void AXPY(const OrdinalType &n, const alpha_type alpha, const x_type *x, const OrdinalType &incx, ScalarType *y, const OrdinalType &incy) const
Perform the operation: y <- y+alpha*x.
void TRMV(EUplo uplo, ETransp trans, EDiag diag, const OrdinalType &n, const A_type *A, const OrdinalType &lda, ScalarType *x, const OrdinalType &incx) const
Performs the matrix-vector operation: x <- A*x or x <- A'*x where A is a unit/non-unit n by n upper/low...
Templated interface class to BLAS routines.
void GEMV(ETransp trans, const OrdinalType &m, const OrdinalType &n, const alpha_type alpha, const A_type *A, const OrdinalType &lda, const x_type *x, const OrdinalType &incx, const beta_type beta, ScalarType *y, const OrdinalType &incy) const
Performs the matrix-vector operation: y <- alpha*A*x+beta*y or y <- alpha*A'*x+beta*y where A is a gene...
void ROT(const OrdinalType &n, ScalarType *dx, const OrdinalType &incx, ScalarType *dy, const OrdinalType &incy, MagnitudeType *c, ScalarType *s) const
Applies a Givens plane rotation.
Basic wall-clock timer class.
ScalarTraits< ScalarType >::magnitudeType NRM2(const OrdinalType &n, const ScalarType *x, const OrdinalType &incx) const
Compute the 2-norm of the vector x.
OrdinalType IAMAX(const OrdinalType &n, const ScalarType *x, const OrdinalType &incx) const
Return the index of the element of x with the maximum magnitude.
void GEMM(ETransp transa, ETransp transb, const OrdinalType &m, const OrdinalType &n, const OrdinalType &k, const alpha_type alpha, const A_type *A, const OrdinalType &lda, const B_type *B, const OrdinalType &ldb, const beta_type beta, ScalarType *C, const OrdinalType &ldc) const
General matrix-matrix multiply.
void PrintMatrix(TYPE *Matrix, OType Rows, OType Columns, OType LDM, std::string Name, bool Matlab=0)
Initialize, finalize, and query the global MPI session.
TEUCHOSNUMERICS_LIB_DLL_EXPORT const char EDiagChar[]
This structure defines some basic traits for a scalar field type.
ScalarTraits< ScalarType >::magnitudeType ASUM(const OrdinalType &n, const ScalarType *x, const OrdinalType &incx) const
Sum the absolute values of the entries of x.
Teuchos::EUplo RandomUPLO()
void COPY(const OrdinalType &n, const ScalarType *x, const OrdinalType &incx, ScalarType *y, const OrdinalType &incy) const
Copy the vector x to the vector y.
TYPE GetRandom(TYPE, TYPE)
Teuchos::ESide RandomSIDE()
TEUCHOSNUMERICS_LIB_DLL_EXPORT const char EUploChar[]
Teuchos::EDiag RandomDIAG()
ScalarType DOT(const OrdinalType &n, const x_type *x, const OrdinalType &incx, const y_type *y, const OrdinalType &incy) const
Form the dot product of the vectors x and y.
bool CompareVectors(TYPE1 *Vector1, TYPE2 *Vector2, OType Size, TYPE2 Tolerance)
bool CompareScalars(TYPE1 Scalar1, TYPE2 Scalar2, TYPE2 Tolerance)
TEUCHOSNUMERICS_LIB_DLL_EXPORT const char ESideChar[]
std::string Teuchos_Version()
void PrintVector(TYPE *Vector, OType Size, std::string Name, bool Matlab=0)
int main(int argc, char *argv[])
bool CompareMatrices(TYPE1 *Matrix1, TYPE2 *Matrix2, OType Rows, OType Columns, OType LDM, TYPE2 Tolerance)
TYPE2 ConvertType(TYPE1, TYPE2)
void SYMM(ESide side, EUplo uplo, const OrdinalType &m, const OrdinalType &n, const alpha_type alpha, const A_type *A, const OrdinalType &lda, const B_type *B, const OrdinalType &ldb, const beta_type beta, ScalarType *C, const OrdinalType &ldc) const
Performs the matrix-matrix operation: C <- alpha*A*B+beta*C or C <- alpha*B*A+beta*C where A is an m ...
void TRMM(ESide side, EUplo uplo, ETransp transa, EDiag diag, const OrdinalType &m, const OrdinalType &n, const alpha_type alpha, const A_type *A, const OrdinalType &lda, ScalarType *B, const OrdinalType &ldb) const
Performs the matrix-matrix operation: B <- alpha*op(A)*B or B <- alpha*B*op(A) where op(A) is an unit...
A MPI utilities class, providing methods for initializing, finalizing, and querying the global MPI se...
void SCAL(const OrdinalType &n, const ScalarType &alpha, ScalarType *x, const OrdinalType &incx) const
Scale the vector x by the constant alpha.
void ROTG(ScalarType *da, ScalarType *db, rotg_c_type *c, ScalarType *s) const
Computes a Givens plane rotation.
TEUCHOSNUMERICS_LIB_DLL_EXPORT const char ETranspChar[]
void SYRK(EUplo uplo, ETransp trans, const OrdinalType &n, const OrdinalType &k, const alpha_type alpha, const A_type *A, const OrdinalType &lda, const beta_type beta, ScalarType *C, const OrdinalType &ldc) const
Performs the symmetric rank k operation: C <- alpha*A*A'+beta*C or C <- alpha*A'*A+beta*C, where alpha and beta are scalars, C is an n by n symmetric matrix and A is an n by k matrix in the first case or k by n matrix in the second case.
Teuchos::ETransp RandomTRANS()
static std::string name()