本文整理汇总了C++中TTimer::usertime方法的典型用法代码示例。如果您正苦于以下问题:C++ TTimer::usertime方法的具体用法?C++ TTimer::usertime怎么用?C++ TTimer::usertime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TTimer
的用法示例。
在下文中一共展示了TTimer::usertime方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv) {
size_t iter = 1;
int q = 1009;
int n = 2000;
std::string file = "";
Argument as[] = {
{ 'q', "-q Q", "Set the field characteristic (-1 for random).", TYPE_INT , &q },
{ 'n', "-n N", "Set the dimension of the matrix.", TYPE_INT , &n },
{ 'i', "-i R", "Set number of repetitions.", TYPE_INT , &iter },
{ 'f', "-f FILE", "Set the input file (empty for random).", TYPE_STR , &file },
END_OF_ARGUMENTS
};
FFLAS::parseArguments(argc,argv,as);
typedef Givaro::Modular<double> Field;
typedef Field::Element Element;
Field F(q);
Element * A;
TTimer chrono;
double time=0.0;
Field::RandIter G(F);
for (size_t i=0;i<iter;++i){
if (!file.empty()){
A = read_field (F, file.c_str(), &n, &n);
} else {
A = FFLAS::fflas_new<Element>(n*n);
for (size_t j=0; j<(size_t) n*n; ++j)
G.random(*(A+j));
}
for (size_t k=0;k<(size_t)n;++k)
while (F.isZero( G.random(*(A+k*(n+1)))));
chrono.clear();
chrono.start();
clapack_dtrtri(CblasRowMajor,CblasUpper, CblasNonUnit,n,A,n);
chrono.stop();
time+=chrono.usertime();
FFLAS::fflas_delete( A);
}
// -----------
// Standard output for benchmark - Alexis Breust 2014/11/14
std::cout << "Time: " << time / double(iter)
<< " Gflops: " << (2.*double(n)/1000.*double(n)/1000.*double(n)/1000.0) / time * double(iter) / 3.;
FFLAS::writeCommandString(std::cout, as) << std::endl;
return 0;
}