33 for (
int j = 0;
j <
rows; ++
j) {
35 cost += 2 * (
r *
j +
r +
j);
44 SquareMatrixType covMat =
a *
a.adjoint();
49 int r = internal::random<int>(0, covMat.rows() - 1);
50 int c = internal::random<int>(0, covMat.cols() - 1);
53 for (
int k = 0;
k < repeats; ++
k) {
55 acc += cholnosqrt.matrixL().coeff(
r,
c);
62 for (
int k = 0;
k < repeats; ++
k) {
64 acc += chol.matrixL().coeff(
r,
c);
69 if (MatrixType::RowsAtCompileTime ==
Dynamic)
72 std::cout <<
"fixed ";
73 std::cout << covMat.rows() <<
" \t" << (timerNoSqrt.
best()) / repeats <<
"s "
74 <<
"(" << 1
e-9 * cost * repeats / timerNoSqrt.
best() <<
" GFLOPS)\t" << (timerSqrt.
best()) / repeats <<
"s "
75 <<
"(" << 1
e-9 * cost * repeats / timerSqrt.
best() <<
" GFLOPS)\n";
78 if (MatrixType::RowsAtCompileTime ==
Dynamic) {
81 gsl_matrix* gslCovMat = gsl_matrix_alloc(covMat.rows(), covMat.cols());
82 gsl_matrix* gslCopy = gsl_matrix_alloc(covMat.rows(), covMat.cols());
84 eiToGsl(covMat, &gslCovMat);
87 for (
int k = 0;
k < repeats; ++
k) {
88 gsl_matrix_memcpy(gslCopy, gslCovMat);
89 gsl_linalg_cholesky_decomp(gslCopy);
90 acc += gsl_matrix_get(gslCopy,
r,
c);
95 std::cout <<
" | \t" << timerSqrt.
value() *
REPEAT / repeats <<
"s";
97 gsl_matrix_free(gslCovMat);
102 if (acc == 123) std::cout << acc;
Array< double, 1, 3 > e(1./3., 0.5, 2.)
int rows
Definition: Tutorial_commainit_02.cpp:1
int cols
Definition: Tutorial_commainit_02.cpp:1
#define REPEAT
Definition: benchCholesky.cpp:18
#define TRIES
Definition: benchCholesky.cpp:22
float Scalar
Definition: benchCholesky.cpp:25
MatrixXf MatrixType
Definition: benchmark-blocking-sizes.cpp:52
Definition: BenchTimer.h:55
double value(int TIMER=CPU_TIMER) const
Definition: BenchTimer.h:94
void reset()
Definition: BenchTimer.h:68
void stop()
Definition: BenchTimer.h:77
void start()
Definition: BenchTimer.h:73
double best(int TIMER=CPU_TIMER) const
Definition: BenchTimer.h:98
Robust Cholesky decomposition of a matrix with pivoting.
Definition: LDLT.h:63
Standard Cholesky decomposition (LL^T) of a matrix and associated features.
Definition: LLT.h:70
The matrix class, also used for vectors and row-vectors.
Definition: Eigen/Eigen/src/Core/Matrix.h:186
#define max(a, b)
Definition: datatypes.h:23
const Scalar * a
Definition: level2_cplx_impl.h:32
int * m
Definition: level2_cplx_impl.h:294
char char char int int * k
Definition: level2_impl.h:374
const int Dynamic
Definition: Constants.h:25
int c
Definition: calibrate.py:100
t
Definition: plotPSD.py:36
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2