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