本文整理汇总了C++中DVector::normInf方法的典型用法代码示例。如果您正苦于以下问题:C++ DVector::normInf方法的具体用法?C++ DVector::normInf怎么用?C++ DVector::normInf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DVector
的用法示例。
在下文中一共展示了DVector::normInf方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
if(verbose) std::cout <<"constructor 3 -- copy constructor (transposed) ";
if ( Con3TestCopyTrans(2, 0) != Con2Test1ExpRes(0, 2) ) {
if (verbose) std::cout << "unsuccessful."<<std::endl;
numberFailedTests++;
} else {
if (verbose) std::cout << "successful."<<std::endl;
}
// constructor 4 (submatrix)
DMatrix Con4TestOrig(Teuchos::Copy, a, 3, 3, 3);
DMatrix Con4TestSubmatrix;
Con4TestSubmatrix.shape(2, 2);
Con4TestSubmatrix(0, 0) = 4; Con4TestSubmatrix(0, 1) = 7;
Con4TestSubmatrix(1, 0) = 5; Con4TestSubmatrix(1, 1) = 8;
DMatrix Con4TestCopy1(Teuchos::Copy, Con4TestOrig, 2, 2, 1, 1);
numberFailedTests += PrintTestResults("constructor 4 -- submatrix copy", Con4TestCopy1, Con4TestSubmatrix, verbose);
DMatrix Con4TestCopy2(Teuchos::Copy, Con4TestOrig, 3, 3, 0, 0);
numberFailedTests += PrintTestResults("constructor 4 -- full matrix copy", Con4TestCopy2, Con4TestOrig, verbose);
DMatrix Con4TestView1(Teuchos::View, Con4TestOrig, 2, 2, 1, 1);
numberFailedTests += PrintTestResults("constructor 4 -- full matrix view", Con4TestView1, Con4TestSubmatrix, verbose);
DMatrix Con4TestView2(Teuchos::View, Con4TestOrig, 3, 3, 0, 0);
numberFailedTests += PrintTestResults("constructor 4 -- submatrix view", Con4TestView2, Con4TestOrig, verbose);
// Norm Tests
DMatrix AAA;
AAA.shape(3, 3);
AAA(0, 0) = 1; AAA(0, 1) = 2; AAA(0, 2) = 3;
AAA(1, 0) = 4; AAA(1, 1) = 5; AAA(1, 2) = 6;
AAA(2, 0) = 7; AAA(2, 1) = 8; AAA(2, 2) = 9;
DMatrix BBB;
numberFailedTests += PrintTestResults("normOne of a 3x3", AAA.normOne(), 18.0, verbose);
numberFailedTests += PrintTestResults("normInf of a 3x3", AAA.normInf(), 24.0, verbose);
AAA = Teuchos::ScalarTraits<STYPE>::one();
numberFailedTests += PrintTestResults("normFrobenius of a 3x3", AAA.normFrobenius(), 3.0, verbose);
numberFailedTests += PrintTestResults("normOne of a 0x0", BBB.normOne(), 0.0, verbose);
numberFailedTests += PrintTestResults("normInf of a 0x0", BBB.normInf(), 0.0, verbose);
numberFailedTests += PrintTestResults("normFrobenius of a 0x0", BBB.normFrobenius(), 0.0, verbose);
// multiply() -- dimensions tests
DMatrix DimTest0x0A, DimTest0x0B, DimTest2x0, DimTest1x2, DimTest2x1, DimTest2x2A, DimTest2x2B,
DimTest3x3, DimTest0x2, DimTest0x0Result, DimTest1x1Result, DimTest2x0Result, DimTest1x2Result, DimTest2x1Result, DimTest2x2Result,
DimTest2x3Result, DimTest0x2Result, DimTest3x3Result;
DimTest0x2.shape(0, 2);
DimTest2x0.shape(2, 0);
DimTest1x2.shape(1, 2);
DimTest2x1.shape(2, 1);
DimTest2x2A.shape(2, 2);
DimTest2x2B.shape(2, 2);
DimTest3x3.shape(3, 3);
DimTest0x2Result.shape(0, 2);
DimTest1x1Result.shape(1, 1);
DimTest2x0Result.shape(2, 0);
DimTest1x2Result.shape(1, 2);
DimTest2x1Result.shape(2, 1);
DimTest2x2Result.shape(2, 2);
DimTest2x3Result.shape(2, 3);
DimTest3x3Result.shape(3, 3);
returnCode = DimTest2x2Result.multiply(Teuchos::NO_TRANS, Teuchos::NO_TRANS, 1, DimTest2x2A, DimTest2x2B, 1);
testName = "multiply() -- dimensions -- compatible square matrices";
numberFailedTests += ReturnCodeCheck(testName, returnCode, 0, verbose);
returnCode = DimTest2x3Result.multiply(Teuchos::NO_TRANS, Teuchos::NO_TRANS, 1, DimTest2x2A, DimTest3x3, 1);