Blender V5.3
numeric.h
Go to the documentation of this file.
1// Copyright (c) 2007, 2008_WIN32 libmv authors.
2//
3// Permission is hereby granted, free of charge, to any person obtaining a copy
4// of this software and associated documentation files (the "Software"), to
5// deal in the Software without restriction, including without limitation the
6// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7// sell copies of the Software, and to permit persons to whom the Software is
8// furnished to do so, subject to the following conditions:
9//
10// The above copyright notice and this permission notice shall be included in
11// all copies or substantial portions of the Software.
12//
13// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19// IN THE SOFTWARE.
20//
21// Matrix and vector classes, based on Eigen2.
22//
23// Avoid using Eigen2 classes directly; instead typedef them here.
24
25#ifndef LIBMV_NUMERIC_NUMERIC_H
26#define LIBMV_NUMERIC_NUMERIC_H
27
28#include <cassert>
29
30#include <Eigen/Cholesky>
31#include <Eigen/Core>
32#include <Eigen/Eigenvalues>
33#include <Eigen/Geometry>
34#include <Eigen/LU>
35#include <Eigen/QR>
36#include <Eigen/SVD>
37
38#if !defined(__MINGW64__)
39# if defined(_WIN32) || defined(__APPLE__) || defined(__NetBSD__) || \
40 defined(__HAIKU__)
41inline void sincos(double x, double* sinx, double* cosx) {
42 *sinx = sin(x);
43 *cosx = cos(x);
44}
45# endif
46#endif // !__MINGW64__
47
48#if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__)
49inline long lround(double d) {
50 return (long)(d > 0 ? d + 0.5 : ceil(d - 0.5));
51}
52# if _MSC_VER < 1800
53inline int round(double d) {
54 return (d > 0) ? int(d + 0.5) : int(d - 0.5);
55}
56# endif // _MSC_VER < 1800
57typedef unsigned int uint;
58#endif // _WIN32
59
60namespace libmv {
61
62typedef Eigen::MatrixXd Mat;
63typedef Eigen::VectorXd Vec;
64
65typedef Eigen::MatrixXf Matf;
66typedef Eigen::VectorXf Vecf;
67
68typedef Eigen::Matrix<unsigned int, Eigen::Dynamic, Eigen::Dynamic> Matu;
69typedef Eigen::Matrix<unsigned int, Eigen::Dynamic, 1> Vecu;
70typedef Eigen::Matrix<unsigned int, 2, 1> Vec2u;
71
72typedef Eigen::Matrix<double, 2, 2> Mat2;
73typedef Eigen::Matrix<double, 2, 3> Mat23;
74typedef Eigen::Matrix<double, 3, 3> Mat3;
75typedef Eigen::Matrix<double, 3, 4> Mat34;
76typedef Eigen::Matrix<double, 3, 5> Mat35;
77typedef Eigen::Matrix<double, 4, 1> Mat41;
78typedef Eigen::Matrix<double, 4, 3> Mat43;
79typedef Eigen::Matrix<double, 4, 4> Mat4;
80typedef Eigen::Matrix<double, 4, 6> Mat46;
81typedef Eigen::Matrix<float, 2, 2> Mat2f;
82typedef Eigen::Matrix<float, 2, 3> Mat23f;
83typedef Eigen::Matrix<float, 3, 3> Mat3f;
84typedef Eigen::Matrix<float, 3, 4> Mat34f;
85typedef Eigen::Matrix<float, 3, 5> Mat35f;
86typedef Eigen::Matrix<float, 4, 3> Mat43f;
87typedef Eigen::Matrix<float, 4, 4> Mat4f;
88typedef Eigen::Matrix<float, 4, 6> Mat46f;
89
90typedef Eigen::Matrix<double, 3, 3, Eigen::RowMajor> RMat3;
91typedef Eigen::Matrix<double, 4, 4, Eigen::RowMajor> RMat4;
92
93typedef Eigen::Matrix<double, 2, Eigen::Dynamic> Mat2X;
94typedef Eigen::Matrix<double, 3, Eigen::Dynamic> Mat3X;
95typedef Eigen::Matrix<double, 4, Eigen::Dynamic> Mat4X;
96typedef Eigen::Matrix<double, Eigen::Dynamic, 2> MatX2;
97typedef Eigen::Matrix<double, Eigen::Dynamic, 3> MatX3;
98typedef Eigen::Matrix<double, Eigen::Dynamic, 4> MatX4;
99typedef Eigen::Matrix<double, Eigen::Dynamic, 5> MatX5;
100typedef Eigen::Matrix<double, Eigen::Dynamic, 6> MatX6;
101typedef Eigen::Matrix<double, Eigen::Dynamic, 7> MatX7;
102typedef Eigen::Matrix<double, Eigen::Dynamic, 8> MatX8;
103typedef Eigen::Matrix<double, Eigen::Dynamic, 9> MatX9;
104typedef Eigen::Matrix<double, Eigen::Dynamic, 15> MatX15;
105typedef Eigen::Matrix<double, Eigen::Dynamic, 16> MatX16;
106
107typedef Eigen::Vector2d Vec2;
108typedef Eigen::Vector3d Vec3;
109typedef Eigen::Vector4d Vec4;
110typedef Eigen::Matrix<double, 5, 1> Vec5;
111typedef Eigen::Matrix<double, 6, 1> Vec6;
112typedef Eigen::Matrix<double, 7, 1> Vec7;
113typedef Eigen::Matrix<double, 8, 1> Vec8;
114typedef Eigen::Matrix<double, 9, 1> Vec9;
115typedef Eigen::Matrix<double, 10, 1> Vec10;
116typedef Eigen::Matrix<double, 11, 1> Vec11;
117typedef Eigen::Matrix<double, 12, 1> Vec12;
118typedef Eigen::Matrix<double, 13, 1> Vec13;
119typedef Eigen::Matrix<double, 14, 1> Vec14;
120typedef Eigen::Matrix<double, 15, 1> Vec15;
121typedef Eigen::Matrix<double, 16, 1> Vec16;
122typedef Eigen::Matrix<double, 17, 1> Vec17;
123typedef Eigen::Matrix<double, 18, 1> Vec18;
124typedef Eigen::Matrix<double, 19, 1> Vec19;
125typedef Eigen::Matrix<double, 20, 1> Vec20;
126
127typedef Eigen::Vector2f Vec2f;
128typedef Eigen::Vector3f Vec3f;
129typedef Eigen::Vector4f Vec4f;
130
131typedef Eigen::VectorXi VecXi;
132
133typedef Eigen::Vector2i Vec2i;
134typedef Eigen::Vector3i Vec3i;
135typedef Eigen::Vector4i Vec4i;
136
137typedef Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>
139
140typedef Eigen::NumTraits<double> EigenDouble;
141
142using Eigen::Dynamic;
143using Eigen::Map;
144using Eigen::Matrix;
145
146// Find U, s, and VT such that
147//
148// A = U * diag(s) * VT
149//
150template <typename TMat, typename TVec>
151inline void SVD(TMat* /*A*/, Vec* /*s*/, Mat* /*U*/, Mat* /*VT*/) {
152 assert(0);
153}
154
155// Solve the linear system Ax = 0 via SVD. Store the solution in x, such that
156// ||x|| = 1.0. Return the singular value corresponding to the solution.
157// Destroys A and resizes x if necessary.
158// TODO(maclean): Take the SVD of the transpose instead of this zero padding.
159template <typename TMat, typename TVec>
160double Nullspace(TMat* A, TVec* nullspace) {
161 Eigen::JacobiSVD<TMat> svd(*A, Eigen::ComputeFullV);
162 (*nullspace) = svd.matrixV().col(A->cols() - 1);
163 if (A->rows() >= A->cols()) {
164 return svd.singularValues()(A->cols() - 1);
165 } else {
166 return 0.0;
167 }
168}
169
170// Solve the linear system Ax = 0 via SVD. Finds two solutions, x1 and x2, such
171// that x1 is the best solution and x2 is the next best solution (in the L2
172// norm sense). Store the solution in x1 and x2, such that ||x|| = 1.0. Return
173// the singular value corresponding to the solution x1. Destroys A and resizes
174// x if necessary.
175template <typename TMat, typename TVec1, typename TVec2>
176double Nullspace2(TMat* A, TVec1* x1, TVec2* x2) {
177 Eigen::JacobiSVD<TMat> svd(*A, Eigen::ComputeFullV);
178 *x1 = svd.matrixV().col(A->cols() - 1);
179 *x2 = svd.matrixV().col(A->cols() - 2);
180 if (A->rows() >= A->cols()) {
181 return svd.singularValues()(A->cols() - 1);
182 } else {
183 return 0.0;
184 }
185}
186
187// In place transpose for square matrices.
188template <class TA>
189inline void TransposeInPlace(TA* A) {
190 *A = A->transpose().eval();
191}
192
193template <typename TVec>
194inline double NormL1(const TVec& x) {
195 return x.array().abs().sum();
196}
197
198template <typename TVec>
199inline double NormL2(const TVec& x) {
200 return x.norm();
201}
202
203template <typename TVec>
204inline double NormLInfinity(const TVec& x) {
205 return x.array().abs().maxCoeff();
206}
207
208template <typename TVec>
209inline double DistanceL1(const TVec& x, const TVec& y) {
210 return (x - y).array().abs().sum();
211}
212
213template <typename TVec>
214inline double DistanceL2(const TVec& x, const TVec& y) {
215 return (x - y).norm();
216}
217template <typename TVec>
218inline double DistanceLInfinity(const TVec& x, const TVec& y) {
219 return (x - y).array().abs().maxCoeff();
220}
221
222// Normalize a vector with the L1 norm, and return the norm before it was
223// normalized.
224template <typename TVec>
225inline double NormalizeL1(TVec* x) {
226 double norm = NormL1(*x);
227 *x /= norm;
228 return norm;
229}
230
231// Normalize a vector with the L2 norm, and return the norm before it was
232// normalized.
233template <typename TVec>
234inline double NormalizeL2(TVec* x) {
235 double norm = NormL2(*x);
236 *x /= norm;
237 return norm;
238}
239
240// Normalize a vector with the L^Infinity norm, and return the norm before it
241// was normalized.
242template <typename TVec>
243inline double NormalizeLInfinity(TVec* x) {
244 double norm = NormLInfinity(*x);
245 *x /= norm;
246 return norm;
247}
248
249// Return the square of a number.
250template <typename T>
251inline T Square(T x) {
252 return x * x;
253}
254
258
259// Returns the rotation matrix of a rotation of angle |axis| around axis.
260// This is computed using the Rodrigues formula, see:
261// http://mathworld.wolfram.com/RodriguesRotationFormula.html
262Mat3 RotationRodrigues(const Vec3& axis);
263
264// Make a rotation matrix such that center becomes the direction of the
265// positive z-axis, and y is oriented close to up.
266Mat3 LookAt(Vec3 center);
267
268// Return a diagonal matrix from a vector containing the diagonal values.
269template <typename TVec>
270inline Mat Diag(const TVec& x) {
271 return x.asDiagonal();
272}
273
274template <typename TMat>
275inline double FrobeniusNorm(const TMat& A) {
276 return sqrt(A.array().abs2().sum());
277}
278
279template <typename TMat>
280inline double FrobeniusDistance(const TMat& A, const TMat& B) {
281 return FrobeniusNorm(A - B);
282}
283
284inline Vec3 CrossProduct(const Vec3& x, const Vec3& y) {
285 return x.cross(y);
286}
287
289
290void MeanAndVarianceAlongRows(const Mat& A,
291 Vec* mean_pointer,
292 Vec* variance_pointer);
293
294#if defined(_WIN32) && !defined(__clang__)
295// TODO(bomboze): un-#if this for both platforms once tested under Windows
296/* This solution was extensively discussed here
297 http://forum.kde.org/viewtopic.php?f=74&t=61940 */
298# define SUM_OR_DYNAMIC(x, y) \
299 (x == Eigen::Dynamic || y == Eigen::Dynamic) ? Eigen::Dynamic : (x + y)
300
301template <typename Derived1, typename Derived2>
302struct hstack_return {
303 typedef typename Derived1::Scalar Scalar;
304 enum {
305 RowsAtCompileTime = Derived1::RowsAtCompileTime,
306 ColsAtCompileTime = SUM_OR_DYNAMIC(Derived1::ColsAtCompileTime,
307 Derived2::ColsAtCompileTime),
308 Options = Derived1::Flags & Eigen::RowMajorBit ? Eigen::RowMajor : 0,
309 MaxRowsAtCompileTime = Derived1::MaxRowsAtCompileTime,
310 MaxColsAtCompileTime = SUM_OR_DYNAMIC(Derived1::MaxColsAtCompileTime,
311 Derived2::MaxColsAtCompileTime)
312 };
313 typedef Eigen::Matrix<Scalar,
314 RowsAtCompileTime,
315 ColsAtCompileTime,
316 Options,
317 MaxRowsAtCompileTime,
318 MaxColsAtCompileTime>
319 type;
320};
321
322template <typename Derived1, typename Derived2>
323typename hstack_return<Derived1, Derived2>::type HStack(
324 const Eigen::MatrixBase<Derived1>& lhs,
325 const Eigen::MatrixBase<Derived2>& rhs) {
326 typename hstack_return<Derived1, Derived2>::type res;
327 res.resize(lhs.rows(), lhs.cols() + rhs.cols());
328 res << lhs, rhs;
329 return res;
330};
331
332template <typename Derived1, typename Derived2>
333struct vstack_return {
334 typedef typename Derived1::Scalar Scalar;
335 enum {
336 RowsAtCompileTime = SUM_OR_DYNAMIC(Derived1::RowsAtCompileTime,
337 Derived2::RowsAtCompileTime),
338 ColsAtCompileTime = Derived1::ColsAtCompileTime,
339 Options = Derived1::Flags & Eigen::RowMajorBit ? Eigen::RowMajor : 0,
340 MaxRowsAtCompileTime = SUM_OR_DYNAMIC(Derived1::MaxRowsAtCompileTime,
341 Derived2::MaxRowsAtCompileTime),
342 MaxColsAtCompileTime = Derived1::MaxColsAtCompileTime
343 };
344 typedef Eigen::Matrix<Scalar,
345 RowsAtCompileTime,
346 ColsAtCompileTime,
347 Options,
348 MaxRowsAtCompileTime,
349 MaxColsAtCompileTime>
350 type;
351};
352
353template <typename Derived1, typename Derived2>
354typename vstack_return<Derived1, Derived2>::type VStack(
355 const Eigen::MatrixBase<Derived1>& lhs,
356 const Eigen::MatrixBase<Derived2>& rhs) {
357 typename vstack_return<Derived1, Derived2>::type res;
358 res.resize(lhs.rows() + rhs.rows(), lhs.cols());
359 res << lhs, rhs;
360 return res;
361};
362
363#else // _WIN32
364
365// Since it is not possible to typedef privately here, use a macro.
366// Always take dynamic columns if either side is dynamic.
367# define COLS \
368 ((ColsLeft == Eigen::Dynamic || ColsRight == Eigen::Dynamic) \
369 ? Eigen::Dynamic \
370 : (ColsLeft + ColsRight))
371
372// Same as above, except that prefer fixed size if either is fixed.
373# define ROWS \
374 ((RowsLeft == Eigen::Dynamic && RowsRight == Eigen::Dynamic) \
375 ? Eigen::Dynamic \
376 : ((RowsLeft == Eigen::Dynamic) ? RowsRight : RowsLeft))
377
378// TODO(keir): Add a static assert if both rows are at compiletime.
379template <typename T, int RowsLeft, int RowsRight, int ColsLeft, int ColsRight>
380Eigen::Matrix<T, ROWS, COLS> HStack(
381 const Eigen::Matrix<T, RowsLeft, ColsLeft>& left,
382 const Eigen::Matrix<T, RowsRight, ColsRight>& right) {
383 assert(left.rows() == right.rows());
384 int n = left.rows();
385 int m1 = left.cols();
386 int m2 = right.cols();
387
388 Eigen::Matrix<T, ROWS, COLS> stacked(n, m1 + m2);
389 stacked.block(0, 0, n, m1) = left;
390 stacked.block(0, m1, n, m2) = right;
391 return stacked;
392}
393
394// Reuse the above macros by swapping the order of Rows and Cols. Nasty, but
395// the duplication is worse.
396// TODO(keir): Add a static assert if both rows are at compiletime.
397// TODO(keir): Mail eigen list about making this work for general expressions
398// rather than only matrix types.
399template <typename T, int RowsLeft, int RowsRight, int ColsLeft, int ColsRight>
400Eigen::Matrix<T, COLS, ROWS> VStack(
401 const Eigen::Matrix<T, ColsLeft, RowsLeft>& top,
402 const Eigen::Matrix<T, ColsRight, RowsRight>& bottom) {
403 assert(top.cols() == bottom.cols());
404 int n1 = top.rows();
405 int n2 = bottom.rows();
406 int m = top.cols();
407
408 Eigen::Matrix<T, COLS, ROWS> stacked(n1 + n2, m);
409 stacked.block(0, 0, n1, m) = top;
410 stacked.block(n1, 0, n2, m) = bottom;
411 return stacked;
412}
413# undef COLS
414# undef ROWS
415#endif // _WIN32
416
417void HorizontalStack(const Mat& left, const Mat& right, Mat* stacked);
418
419template <typename TTop, typename TBot, typename TStacked>
420void VerticalStack(const TTop& top, const TBot& bottom, TStacked* stacked) {
421 assert(top.cols() == bottom.cols());
422 int n1 = top.rows();
423 int n2 = bottom.rows();
424 int m = top.cols();
425
426 stacked->resize(n1 + n2, m);
427 stacked->block(0, 0, n1, m) = top;
428 stacked->block(n1, 0, n2, m) = bottom;
429}
430
431void MatrixColumn(const Mat& A, int i, Vec2* v);
432void MatrixColumn(const Mat& A, int i, Vec3* v);
433void MatrixColumn(const Mat& A, int i, Vec4* v);
434
435template <typename TMat, typename TCols>
436TMat ExtractColumns(const TMat& A, const TCols& columns) {
437 TMat compressed(A.rows(), columns.size());
438 for (int i = 0; i < columns.size(); ++i) {
439 compressed.col(i) = A.col(columns[i]);
440 }
441 return compressed;
442}
443
444template <typename TMat, typename TDest>
445void reshape(const TMat& a, int rows, int cols, TDest* b) {
446 assert(a.rows() * a.cols() == rows * cols);
447 b->resize(rows, cols);
448 for (int i = 0; i < rows; i++) {
449 for (int j = 0; j < cols; j++) {
450 (*b)(i, j) = a[cols * i + j];
451 }
452 }
453}
454
455inline bool isnan(double i) {
456#ifdef WIN32
457 return _isnan(i) > 0;
458#else
459 return std::isnan(i);
460#endif
461}
462
465template <typename FloatType>
466FloatType ceil0(const FloatType& value) {
467 FloatType result = std::ceil(std::fabs(value));
468 return (value < 0.0) ? -result : result;
469}
470
472inline Mat3 SkewMat(const Vec3& x) {
473 Mat3 skew;
474 skew << 0, -x(2), x(1), x(2), 0, -x(0), -x(1), x(0), 0;
475 return skew;
476}
477
479inline Mat23 SkewMatMinimal(const Vec2& x) {
480 Mat23 skew;
481 skew << 0, -1, x(1), 1, 0, -x(0);
482 return skew;
483}
484
486inline Mat3 RotationFromEulerVector(Vec3 euler_vector) {
487 double theta = euler_vector.norm();
488 if (theta == 0.0) {
489 return Mat3::Identity();
490 }
491 Vec3 w = euler_vector / theta;
492 Mat3 w_hat = CrossProductMatrix(w);
493 return Mat3::Identity() + w_hat * sin(theta) +
494 w_hat * w_hat * (1 - cos(theta));
495}
496} // namespace libmv
497
498#endif // LIBMV_NUMERIC_NUMERIC_H
#define A
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition btQuadWord.h:119
SIMD_FORCE_INLINE btScalar norm() const
Return the norm (length) of the vector.
Definition btVector3.h:263
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
Definition btVector3.h:356
#define assert(assertion)
#define sin
#define round
#define cos
#define ceil
#define sqrt
ccl_device_inline void sincos(const float3 x, ccl_private float3 *sine, ccl_private float3 *cosine)
#define T
#define B
unsigned int uint
Definition BKE_text.h:55
float Scalar
Definition eigen_utils.h:28
double DistanceLInfinity(const TVec &x, const TVec &y)
Definition numeric.h:218
Eigen::Matrix< double, 19, 1 > Vec19
Definition numeric.h:124
T Square(T x)
Definition numeric.h:251
Eigen::Matrix< float, 3, 5 > Mat35f
Definition numeric.h:85
Mat Diag(const TVec &x)
Definition numeric.h:270
Eigen::VectorXd Vec
Definition numeric.h:63
bool isnan(double i)
Definition numeric.h:455
Eigen::Matrix< double, 11, 1 > Vec11
Definition numeric.h:116
Eigen::Vector4i Vec4i
Definition numeric.h:135
double Nullspace(TMat *A, TVec *nullspace)
Definition numeric.h:160
Eigen::Vector4d Vec4
Definition numeric.h:109
Eigen::Matrix< double, 6, 1 > Vec6
Definition numeric.h:111
double NormL2(const TVec &x)
Definition numeric.h:199
Eigen::Matrix< double, 3, 3, Eigen::RowMajor > RMat3
Definition numeric.h:90
Eigen::Matrix< double, 13, 1 > Vec13
Definition numeric.h:118
Mat3 CrossProductMatrix(const Vec3 &x)
Definition numeric.cc:80
double DistanceL1(const TVec &x, const TVec &y)
Definition numeric.h:209
Eigen::Matrix< double, 10, 1 > Vec10
Definition numeric.h:115
Mat3 RotationFromEulerVector(Vec3 euler_vector)
Returns the rotation matrix built from given vector of euler angles.
Definition numeric.h:486
void TransposeInPlace(TA *A)
Definition numeric.h:189
Eigen::Matrix< double, Eigen::Dynamic, 2 > MatX2
Definition numeric.h:96
Eigen::Vector3i Vec3i
Definition numeric.h:134
Eigen::Matrix< double, 4, 4 > Mat4
Definition numeric.h:79
void VerticalStack(const TTop &top, const TBot &bottom, TStacked *stacked)
Definition numeric.h:420
Eigen::Matrix< double, 4, 1 > Mat41
Definition numeric.h:77
Eigen::Matrix< double, Eigen::Dynamic, 3 > MatX3
Definition numeric.h:97
Eigen::Matrix< double, Eigen::Dynamic, 15 > MatX15
Definition numeric.h:104
double DistanceL2(const TVec &x, const TVec &y)
Definition numeric.h:214
Eigen::Matrix< double, 3, 3 > Mat3
Definition numeric.h:74
void SVD(TMat *, Vec *, Mat *, Mat *)
Definition numeric.h:151
Eigen::Matrix< double, Eigen::Dynamic, 4 > MatX4
Definition numeric.h:98
Eigen::Vector2d Vec2
Definition numeric.h:107
Eigen::Matrix< double, Eigen::Dynamic, 5 > MatX5
Definition numeric.h:99
double NormalizeL1(TVec *x)
Definition numeric.h:225
Mat3 RotationAroundX(double angle)
Definition numeric.cc:25
Eigen::Matrix< float, 2, 2 > Mat2f
Definition numeric.h:81
double NormLInfinity(const TVec &x)
Definition numeric.h:204
Eigen::Matrix< float, 4, 3 > Mat43f
Definition numeric.h:86
double FrobeniusDistance(const TMat &A, const TMat &B)
Definition numeric.h:280
Eigen::Matrix< double, 4, 4, Eigen::RowMajor > RMat4
Definition numeric.h:91
Eigen::VectorXf Vecf
Definition numeric.h:66
Eigen::Matrix< double, 14, 1 > Vec14
Definition numeric.h:119
Eigen::Matrix< double, 4, 6 > Mat46
Definition numeric.h:80
Eigen::MatrixXd Mat
Definition numeric.h:62
void MatrixColumn(const Mat &A, int i, Vec2 *v)
Definition numeric.cc:127
void MeanAndVarianceAlongRows(const Mat &A, Vec *mean_pointer, Vec *variance_pointer)
Definition numeric.cc:90
Mat23 SkewMatMinimal(const Vec2 &x)
Definition numeric.h:479
Eigen::Matrix< T, ROWS, COLS > HStack(const Eigen::Matrix< T, RowsLeft, ColsLeft > &left, const Eigen::Matrix< T, RowsRight, ColsRight > &right)
Definition numeric.h:380
Eigen::Matrix< double, 7, 1 > Vec7
Definition numeric.h:112
Eigen::Matrix< float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > RMatf
Definition numeric.h:138
Eigen::Vector4f Vec4f
Definition numeric.h:129
Eigen::Matrix< double, Eigen::Dynamic, 9 > MatX9
Definition numeric.h:103
double NormalizeLInfinity(TVec *x)
Definition numeric.h:243
Eigen::Matrix< double, Eigen::Dynamic, 8 > MatX8
Definition numeric.h:102
Eigen::NumTraits< double > EigenDouble
Definition numeric.h:140
Eigen::MatrixXf Matf
Definition numeric.h:65
Eigen::Matrix< float, 3, 3 > Mat3f
Definition numeric.h:83
Mat3 RotationRodrigues(const Vec3 &axis)
Definition numeric.cc:61
Eigen::Matrix< double, 2, 3 > Mat23
Definition numeric.h:73
Eigen::Matrix< double, 3, 4 > Mat34
Definition numeric.h:75
Eigen::Matrix< double, Eigen::Dynamic, 7 > MatX7
Definition numeric.h:101
Eigen::Matrix< double, 8, 1 > Vec8
Definition numeric.h:113
Eigen::Matrix< unsigned int, Eigen::Dynamic, 1 > Vecu
Definition numeric.h:69
Mat3 SkewMat(const Vec3 &x)
Returns the skew anti-symmetric matrix of a vector.
Definition numeric.h:472
Eigen::Vector3f Vec3f
Definition numeric.h:128
Eigen::Matrix< double, 18, 1 > Vec18
Definition numeric.h:123
Eigen::VectorXi VecXi
Definition numeric.h:131
Eigen::Matrix< double, Eigen::Dynamic, 16 > MatX16
Definition numeric.h:105
Eigen::Matrix< double, 5, 1 > Vec5
Definition numeric.h:110
Eigen::Matrix< double, 15, 1 > Vec15
Definition numeric.h:120
FloatType ceil0(const FloatType &value)
Definition numeric.h:466
Eigen::Vector3d Vec3
Definition numeric.h:108
Eigen::Matrix< double, 4, Eigen::Dynamic > Mat4X
Definition numeric.h:95
Eigen::Matrix< double, 3, Eigen::Dynamic > Mat3X
Definition numeric.h:94
Eigen::Matrix< float, 2, 3 > Mat23f
Definition numeric.h:82
Eigen::Matrix< float, 3, 4 > Mat34f
Definition numeric.h:84
Eigen::Matrix< double, 3, 5 > Mat35
Definition numeric.h:76
Eigen::Matrix< unsigned int, Eigen::Dynamic, Eigen::Dynamic > Matu
Definition numeric.h:68
double FrobeniusNorm(const TMat &A)
Definition numeric.h:275
Eigen::Matrix< double, 12, 1 > Vec12
Definition numeric.h:117
Eigen::Matrix< double, 16, 1 > Vec16
Definition numeric.h:121
Eigen::Vector2f Vec2f
Definition numeric.h:127
Eigen::Vector2i Vec2i
Definition numeric.h:133
Eigen::Matrix< T, COLS, ROWS > VStack(const Eigen::Matrix< T, ColsLeft, RowsLeft > &top, const Eigen::Matrix< T, ColsRight, RowsRight > &bottom)
Definition numeric.h:400
Eigen::Matrix< double, 20, 1 > Vec20
Definition numeric.h:125
void HorizontalStack(const Mat &left, const Mat &right, Mat *stacked)
Definition numeric.cc:116
Mat3 RotationAroundZ(double angle)
Definition numeric.cc:49
void reshape(const TMat &a, int rows, int cols, TDest *b)
Definition numeric.h:445
Eigen::Matrix< double, 9, 1 > Vec9
Definition numeric.h:114
Eigen::Matrix< double, 2, Eigen::Dynamic > Mat2X
Definition numeric.h:93
Mat3 RotationAroundY(double angle)
Definition numeric.cc:37
Eigen::Matrix< float, 4, 6 > Mat46f
Definition numeric.h:88
double NormalizeL2(TVec *x)
Definition numeric.h:234
double Nullspace2(TMat *A, TVec1 *x1, TVec2 *x2)
Definition numeric.h:176
Eigen::Matrix< double, 17, 1 > Vec17
Definition numeric.h:122
Eigen::Matrix< double, 2, 2 > Mat2
Definition numeric.h:72
TMat ExtractColumns(const TMat &A, const TCols &columns)
Definition numeric.h:436
Eigen::Matrix< float, 4, 4 > Mat4f
Definition numeric.h:87
Mat3 LookAt(Vec3 center)
Definition numeric.cc:69
Eigen::Matrix< unsigned int, 2, 1 > Vec2u
Definition numeric.h:70
Vec3 CrossProduct(const Vec3 &x, const Vec3 &y)
Definition numeric.h:284
double NormL1(const TVec &x)
Definition numeric.h:194
Eigen::Matrix< double, Eigen::Dynamic, 6 > MatX6
Definition numeric.h:100
Eigen::Matrix< double, 4, 3 > Mat43
Definition numeric.h:78