1 #include <shark/LinAlg/BLAS/blas.h> 8 template<
class MatA,
class Triang>
10 blas::matrix_expression<MatA, blas::cpu_tag>
const& A,
13 double minTime = std::numeric_limits<double>::max();
14 volatile double res = 0;
15 for(std::size_t i = 0; i != 20; ++i){
16 typename blas::matrix_temporary<MatA>::type Acopy =A;
18 blas::kernels::potrf<Triang>(Acopy);
19 minTime = min(minTime,time.
stop());
22 return (1.0/3.0*A().size1()*A().size1()*A().size1())/minTime/1024/1024;
25 int main(
int argc,
char **argv) {
26 std::size_t size = 128;
27 std::cout<<
"Mega Flops"<<std::endl;
28 for(std::size_t iter = 0; iter != 10; ++iter){
29 blas::matrix<double,blas::row_major> Arow(size,size);
30 for(std::size_t i = 0; i != size; ++i){
31 for(std::size_t j = 0; j != size; ++j){
32 Arow(i,j) = 0.1/size*i+0.1/size*j;
36 blas::matrix<double,blas::column_major> Acol = Arow;
37 std::cout<<size<<
"\t upper\t"<<
benchmark(Arow,blas::upper())<<
"\t"<<
benchmark(Acol,blas::upper())<<std::endl;
38 std::cout<<size<<
"\t lower\t"<<
benchmark(Arow,blas::lower())<<
"\t"<<
benchmark(Acol,blas::lower())<<std::endl;