timeLinearize.h
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 #pragma once
20 
23 
24 #include <time.h>
25 #include <iostream>
26 #include <iomanip>
27 
28 static const int n = 1000000;
29 
30 void timeSingleThreaded(const std::string& str,
32  long timeLog = clock();
34  for (int i = 0; i < n; i++)
35  gf = f->linearize(values);
36  long timeLog2 = clock();
37  double seconds = (double) (timeLog2 - timeLog) / CLOCKS_PER_SEC;
38  std::cout << std::setprecision(3);
39  std::cout << str << ((double) seconds * 1000000 / n) << " musecs/call"
40  << std::endl;
41 }
42 
43 void timeMultiThreaded(const std::string& str,
46  for (int i = 0; i < n; i++)
47  graph.push_back(f);
48  long timeLog = clock();
50  long timeLog2 = clock();
51  double seconds = (double) (timeLog2 - timeLog) / CLOCKS_PER_SEC;
52  std::cout << std::setprecision(3);
53  std::cout << str << ((double) seconds * 1000000 / n) << " musecs/call"
54  << std::endl;
55 }
56 
static const int n
Definition: timeLinearize.h:28
Factor Graph consisting of non-linear factors.
void timeSingleThreaded(const std::string &str, const gtsam::NonlinearFactor::shared_ptr &f, const gtsam::Values &values)
Definition: timeLinearize.h:30
boost::shared_ptr< This > shared_ptr
shared_ptr to this class
leaf::MyValues values
IsDerived< DERIVEDFACTOR > push_back(boost::shared_ptr< DERIVEDFACTOR > factor)
Add a factor directly using a shared_ptr.
Definition: FactorGraph.h:166
NonlinearFactorGraph graph
Definition: pytypes.h:928
boost::shared_ptr< This > shared_ptr
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
Linear Factor Graph where all factors are Gaussians.
boost::shared_ptr< This > shared_ptr
shared_ptr to this class
void timeMultiThreaded(const std::string &str, const gtsam::NonlinearFactor::shared_ptr &f, const gtsam::Values &values)
Definition: timeLinearize.h:43
boost::shared_ptr< GaussianFactorGraph > linearize(const Values &linearizationPoint) const
Linearize a nonlinear factor graph.


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:50:34