25#define MKL_BLAS MKL_DOMAIN_BLAS
38typedef Eigen::VectorXd Vector;
41typedef Eigen::Matrix<double, 1, 1> Vector1;
42typedef Eigen::Vector2d Vector2;
43typedef Eigen::Vector3d Vector3;
45static const Eigen::MatrixBase<Vector2>::ConstantReturnType Z_2x1 = Vector2::Zero();
46static const Eigen::MatrixBase<Vector3>::ConstantReturnType Z_3x1 = Vector3::Zero();
50#define GTSAM_MAKE_VECTOR_DEFS(N) \
51 using Vector##N = Eigen::Matrix<double, N, 1>; \
52 static const Eigen::MatrixBase<Vector##N>::ConstantReturnType Z_##N##x1 = Vector##N::Zero();
54GTSAM_MAKE_VECTOR_DEFS(4)
55GTSAM_MAKE_VECTOR_DEFS(5)
56GTSAM_MAKE_VECTOR_DEFS(6)
57GTSAM_MAKE_VECTOR_DEFS(7)
58GTSAM_MAKE_VECTOR_DEFS(8)
59GTSAM_MAKE_VECTOR_DEFS(9)
60GTSAM_MAKE_VECTOR_DEFS(10)
61GTSAM_MAKE_VECTOR_DEFS(11)
62GTSAM_MAKE_VECTOR_DEFS(12)
63GTSAM_MAKE_VECTOR_DEFS(15)
65typedef Eigen::VectorBlock<Vector> SubVector;
66typedef Eigen::VectorBlock<const Vector> ConstSubVector;
73#if defined(GTSAM_EIGEN_VERSION_WORLD)
75 GTSAM_EIGEN_VERSION_WORLD==EIGEN_WORLD_VERSION &&
76 GTSAM_EIGEN_VERSION_MAJOR==EIGEN_MAJOR_VERSION,
77 "Error: GTSAM was built against a different version of Eigen");
96GTSAM_EXPORT
bool fpEqual(
double a,
double b,
double tol,
97 bool check_relative_also =
true);
102GTSAM_EXPORT
void print(
const Vector& v,
const std::string& s, std::ostream& stream);
107GTSAM_EXPORT
void print(
const Vector& v,
const std::string& s =
"");
112GTSAM_EXPORT
void save(
const Vector& A,
const std::string &s,
const std::string& filename);
117GTSAM_EXPORT
bool operator==(
const Vector& vec1,
const Vector& vec2);
129GTSAM_EXPORT
bool equal_with_abs_tol(
const Vector& vec1,
const Vector& vec2,
double tol=1e-9);
130GTSAM_EXPORT
bool equal_with_abs_tol(
const SubVector& vec1,
const SubVector& vec2,
double tol=1e-9);
135inline bool equal(
const Vector& vec1,
const Vector& vec2,
double tol) {
142inline bool equal(
const Vector& vec1,
const Vector& vec2) {
153GTSAM_EXPORT
bool assert_equal(
const Vector& vec1,
const Vector& vec2,
double tol=1e-9);
162GTSAM_EXPORT
bool assert_inequal(
const Vector& vec1,
const Vector& vec2,
double tol=1e-9);
171GTSAM_EXPORT
bool assert_equal(
const SubVector& vec1,
const SubVector& vec2,
double tol=1e-9);
172GTSAM_EXPORT
bool assert_equal(
const ConstSubVector& vec1,
const ConstSubVector& vec2,
double tol=1e-9);
181GTSAM_EXPORT
bool linear_dependent(
const Vector& vec1,
const Vector& vec2,
double tol=1e-9);
189GTSAM_EXPORT Vector
ediv_(
const Vector &a,
const Vector &b);
194template<
class V1,
class V2>
195inline double dot(
const V1 &a,
const V2& b) {
196 assert (b.size()==a.size());
201template<
class V1,
class V2>
203 assert (b.size()==a.size());
207#ifdef GTSAM_ALLOW_DEPRECATED_SINCE_V42
212inline void GTSAM_DEPRECATED scal(
double alpha, Vector& x) { x *= alpha; }
218template<
class V1,
class V2>
219inline void GTSAM_DEPRECATED
axpy(
double alpha,
const V1& x, V2& y) {
220 assert (y.size()==x.size());
223inline void axpy(
double alpha,
const Vector& x, SubVector y) {
224 assert (y.size()==x.size());
234GTSAM_EXPORT std::pair<double,Vector>
house(
const Vector &x);
249GTSAM_EXPORT std::pair<Vector, double>
250weightedPseudoinverse(
const Vector& v,
const Vector& weights);
257GTSAM_EXPORT
double weightedPseudoinverse(
const Vector& a,
const Vector& weights, Vector& pseudo);
262GTSAM_EXPORT Vector
concatVectors(
const std::list<Vector>& vs);
Included from all GTSAM files.
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
Vector ediv_(const Vector &a, const Vector &b)
elementwise division, but 0/0 = 0, not inf
Definition: Vector.cpp:199
bool greaterThanOrEqual(const Vector &vec1, const Vector &vec2)
Greater than or equal to operation returns true if all elements in v1 are greater than corresponding ...
Definition: Vector.cpp:114
void save(const Matrix &A, const string &s, const string &filename)
save a matrix to file, which can be loaded by matlab
Definition: Matrix.cpp:167
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
equals with an tolerance, prints out message if unequal
Definition: Matrix.cpp:43
bool linear_dependent(const Matrix &A, const Matrix &B, double tol)
check whether the rows of two matrices are linear dependent
Definition: Matrix.cpp:117
double inner_prod(const V1 &a, const V2 &b)
compatibility version for ublas' inner_prod()
Definition: Vector.h:202
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition: Matrix.cpp:156
void axpy(double alpha, const Errors &x, Errors &y)
BLAS level 2 style AXPY, y := alpha*x + y
Definition: Errors.cpp:111
bool assert_inequal(const Matrix &A, const Matrix &B, double tol)
inequals with an tolerance, prints out message if within tolerance
Definition: Matrix.cpp:63
double houseInPlace(Vector &v)
beta = house(x) computes the HouseHolder vector in place
Definition: Vector.cpp:212
bool equal(const T &obj1, const T &obj2, double tol)
Call equal on the object.
Definition: Testable.h:84
double dot(const V1 &a, const V2 &b)
Dot product.
Definition: Vector.h:195
bool fpEqual(double a, double b, double tol, bool check_relative_also)
Ensure we are not including a different version of Eigen in user code than while compiling gtsam,...
Definition: Vector.cpp:42
Vector concatVectors(const std::list< Vector > &vs)
concatenate Vectors
Definition: Vector.cpp:302
bool equal_with_abs_tol(const Eigen::DenseBase< MATRIX > &A, const Eigen::DenseBase< MATRIX > &B, double tol=1e-9)
equals with a tolerance
Definition: Matrix.h:81
pair< double, Vector > house(const Vector &x)
house(x,j) computes HouseHolder vector v and scaling factor beta from x, such that the corresponding ...
Definition: Vector.cpp:237
bool operator==(const Matrix &A, const Matrix &B)
equality is just equal_with_abs_tol 1e-9
Definition: Matrix.h:100