本文整理汇总了C++中DVector::length方法的典型用法代码示例。如果您正苦于以下问题:C++ DVector::length方法的具体用法?C++ DVector::length怎么用?C++ DVector::length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DVector
的用法示例。
在下文中一共展示了DVector::length方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
numberFailedTests++;
}
if (verbose) std::cout << "operator+= -- add two matrices of different size (nothing should change) ";
CCCtest1 += CCC;
if (CCCtest1(1,1)==2.0) {
if(verbose) std::cout<<"successful" <<std::endl;
} else {
if (verbose) std::cout<<"unsuccessful"<<std::endl;
numberFailedTests++;
}
//
// Check overloaded operators.
//
bool op_result;
MultTestHugeATimesHugeB.reshape(10, 10);
op_result = (MultTestHugeATimesHugeB == MultTestHugeATimesHugeBExpResult);
if (verbose) {
std::cout << "operator== -- results -- small == huge "<< (op_result == false ? "successful" : "failed" )<<std::endl;
}
op_result = (MultTestHugeATimesHugeB != MultTestHugeATimesHugeBExpResult);
if (verbose) {
std::cout << "operator!= -- results -- small != huge "<< (op_result == true ? "successful" : "failed" )<<std::endl;
std::cout << std::endl<< MultTestHugeATimesHugeB << std::endl;
//These won't work unless boundschecking is enabled.
//std::cout << MultTestHugeATimesHugeB(100, 1) << std::endl;
//std::cout << MultTestHugeATimesHugeB(1, 100) << std::endl;
}
if (verbose) std::cout<<std::endl<<"********** CHECKING TEUCHOS SERIAL DENSE VECTOR **********"<<std::endl<<std::endl;
DVector DefConTestV;
if (verbose) std::cout <<"default constructor -- construct empty std::vector ";
if ( DefConTestV.values()!=NULL || DefConTestV.length()!=0 || DefConTestV.numRows()!=0 ||DefConTestV.stride()!=0 ) {
if (verbose) std::cout << "unsuccessful."<<std::endl;
numberFailedTests++;
} else {
if (verbose) std::cout << "successful."<<std::endl;
}
// constructor 1 (matrix w/ dimension but empty)
DVector Con1TestV( 3 );
if (verbose) std::cout <<"constructor 1 -- empty std::vector with given dimensions ";
if ( Con1TestV.length()!=3 || Con1TestV.numCols()!=1 || Con1TestV( 1 )!=0.0 ) {
if (verbose) std::cout << "unsuccessful."<<std::endl;
numberFailedTests++;
} else {
if (verbose) std::cout << "successful."<<std::endl;
}
// constructor 2 (from array) tests
DVector Con2Test1V(Teuchos::Copy, a, 4);
if (verbose) std::cout <<"constructor 2 -- construct std::vector from array subrange ";
if ( Con2Test1V.numRows()!=4 || Con2Test1V.numCols()!=1 || Con2Test1V[ 2 ]!=2.0 ) {
if (verbose) std::cout << "unsuccessful."<<std::endl;
numberFailedTests++;
} else {
if (verbose) std::cout << "successful."<<std::endl;
}
// constructor 3 (copy constructor)
DVector Con3TestCopyV( Con2Test1V );
if(verbose) std::cout <<"constructor 3 -- copy constructor ";