timeCholesky.cpp
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9 
10  * -------------------------------------------------------------------------- */
11 
19 #include <gtsam/base/cholesky.h>
20 
21 #include <time.h>
22 #include <iostream>
23 #include <iomanip> // std::setprecision
24 
25 using namespace std;
26 using namespace gtsam;
27 
28 //#define TERNARY
29 
30 int main() {
31 
32  Matrix top = (Matrix(7,7) <<
33  4.0375, 3.4584, 3.5735, 2.4815, 2.1471, 2.7400, 2.2063,
34  0., 4.7267, 3.8423, 2.3624, 2.8091, 2.9579, 2.5914,
35  0., 0., 5.1600, 2.0797, 3.4690, 3.2419, 2.9992,
36  0., 0., 0., 1.8786, 1.0535, 1.4250, 1.3347,
37  0., 0., 0., 0., 3.0788, 2.6283, 2.3791,
38  0., 0., 0., 0., 0., 2.9227, 2.4056,
39  0., 0., 0., 0., 0., 0., 2.5776).finished();
40 
41  Matrix ABC(100,100);
42  ABC.topLeftCorner<7,7>() = top;
43  cout << setprecision(3);
44 
45  size_t n = 100000;
46  for (size_t nFrontal = 1; nFrontal <= 7; nFrontal++) {
47  auto timeLog = clock();
48  for (size_t i = 0; i < n; i++) {
49  Matrix RSL(ABC);
50  choleskyPartial(RSL, nFrontal);
51  }
52  auto timeLog2 = clock();
53  auto seconds = (double)(timeLog2 - timeLog) / CLOCKS_PER_SEC;
54  cout << "partialCholesky " << nFrontal << ": ";
55  auto ms = ((double)seconds * 1000000 / n);
56  cout << ms << " ms, " << ms/nFrontal << " ms/dim" << endl;
57  }
58 
59  return 0;
60 }
cholesky.h
Efficient incomplete Cholesky on rank-deficient matrices, todo: constrained Cholesky.
gtsam::Matrix
Eigen::MatrixXd Matrix
Definition: base/Matrix.h:39
n
int n
Definition: BiCGSTAB_simple.cpp:1
ceres::Matrix
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > Matrix
Definition: gtsam/3rdparty/ceres/eigen.h:42
gtsam
traits
Definition: SFMdata.h:40
ms
static const double ms
Definition: TimeOfArrivalExample.cpp:33
gtsam::choleskyPartial
bool choleskyPartial(Matrix &ABC, size_t nFrontal, size_t topleft)
Definition: base/cholesky.cpp:107
std
Definition: BFloat16.h:88
main
int main()
Definition: timeCholesky.cpp:30
i
int i
Definition: BiCGSTAB_step_by_step.cpp:9


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:08:59