20 using namespace gtsam;
25 #define NUM_ITERATIONS 1000 28 ofstream
os(
"timeSchurFactors.csv");
31 template<
typename CAMERA>
37 static const int D = CAMERA::dimension;
40 vector <Matrix2D, Eigen::aligned_allocator<Matrix2D>> Fblocks;
41 for (
size_t i = 0;
i <
m;
i++) {
43 Fblocks.push_back((
i + 1) * Matrix::Ones(2, D));
48 for (
size_t i = 0;
i <
m;
i++)
49 E.block < 2, 3 > (2 *
i, 0) = Matrix::Ones(2, 3);
55 const Vector b = Vector::Constant(2*m,1);
61 for (
size_t i = 0;
i <
m;
i++)
62 xvalues.
insert(
i, Vector::Constant(D,2));
73 #define TIME(label,factor,xx,yy) {\ 74 for (size_t t = 0; t < N; t++) \ 75 factor.multiplyHessianAdd(alpha, xx, yy);\ 77 for (size_t t = 0; t < N; t++) {\ 78 factor.multiplyHessianAdd(alpha, xx, yy);\ 81 tictoc_getNode(timer, label)\ 82 os << timer->secs()/NUM_ITERATIONS << ", ";\ 86 TIME(Implicit, implicitFactor, xvalues, yvalues)
87 TIME(Jacobian, jf, xvalues, yvalues)
88 TIME(JacobianQR, jqr, xvalues, yvalues)
92 TIME(Hessian, hessianFactor, xvalues, yvalues)
97 TIME(Overhead,dummy,xvalues,yvalues)
103 for (
size_t i = 0;
i <
m;
i++)
106 double* xdata = x.data();
109 Vector y = Vector::Zero(m * D);
110 TIME(RawImplicit, implicitFactor, xdata, y.data())
111 TIME(RawJacobianQ, jf, xdata, y.data())
112 TIME(RawJacobianQR, jqr, xdata, y.data())
134 os <<
"RawImplicit,";
135 os <<
"RawJacobianQ,";
136 os <<
"RawJacobianQR,";
140 vector < size_t >
ms;
146 for (
size_t m = 2;
m <= 50;
m += 2)
Pinhole camera with known calibration.
noiseModel::Diagonal::shared_ptr model
std::vector< T, typename internal::FastDefaultVectorAllocator< T >::type > FastVector
iterator insert(const std::pair< Key, Vector > &key_value)
EIGEN_DEVICE_FUNC const InverseReturnType inverse() const
noiseModel::Diagonal::shared_ptr SharedDiagonal
A subclass of GaussianFactor specialized to structureless SFM.
#define TIME(label, factor, xx, yy)
ofstream os("timeSchurFactors.csv")
void timeAll(size_t m, size_t N)
A Gaussian factor using the canonical parameters (information form)
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
The matrix class, also used for vectors and row-vectors.
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
Calibration used by Bundler.