Moved inlines inside #ifdef. Passes unit tests with ALLOW_DEPRECATED ON
parent
652edb6e61
commit
03e662062f
|
|
@ -42,11 +42,6 @@ bool zero(const Vector& v) {
|
|||
return result;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
Vector delta(size_t n, size_t i, double value) {
|
||||
return Vector::Unit(n, i) * value;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
//3 argument call
|
||||
void print(const Vector& v, const string& s, ostream& stream) {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
// \callgraph
|
||||
|
||||
|
||||
#pragma once
|
||||
#ifndef MKL_BLAS
|
||||
#define MKL_BLAS MKL_DOMAIN_BLAS
|
||||
|
|
@ -63,47 +62,11 @@ GTSAM_MAKE_VECTOR_DEFS(12);
|
|||
typedef Eigen::VectorBlock<Vector> SubVector;
|
||||
typedef Eigen::VectorBlock<const Vector> ConstSubVector;
|
||||
|
||||
/**
|
||||
* Create basis vector of dimension n,
|
||||
* with a constant in spot i
|
||||
* @param n is the size of the vector
|
||||
* @param i index of the one
|
||||
* @param value is the value to insert into the vector
|
||||
* @return delta vector
|
||||
*/
|
||||
GTSAM_EXPORT Vector delta(size_t n, size_t i, double value);
|
||||
|
||||
/**
|
||||
* Create basis vector of dimension n,
|
||||
* with one in spot i
|
||||
* @param n is the size of the vector
|
||||
* @param i index of the one
|
||||
* @return basis vector
|
||||
*/
|
||||
inline Vector basis(size_t n, size_t i) { return delta(n, i, 1.0); }
|
||||
|
||||
/**
|
||||
* Create zero vector
|
||||
* @param n size
|
||||
*/
|
||||
inline Vector zero(size_t n) { return Vector::Zero(n);}
|
||||
|
||||
/**
|
||||
* Create vector initialized to ones
|
||||
* @param n size
|
||||
*/
|
||||
inline Vector ones(size_t n) { return Vector::Ones(n); }
|
||||
|
||||
/**
|
||||
* check if all zero
|
||||
*/
|
||||
GTSAM_EXPORT bool zero(const Vector& v);
|
||||
|
||||
/**
|
||||
* dimensionality == size
|
||||
*/
|
||||
inline size_t dim(const Vector& v) { return v.size(); }
|
||||
|
||||
/**
|
||||
* print without optional string, must specify cout yourself
|
||||
*/
|
||||
|
|
@ -274,17 +237,24 @@ GTSAM_EXPORT Vector concatVectors(size_t nrVectors, ...);
|
|||
|
||||
|
||||
#ifdef GTSAM_ALLOW_DEPRECATED_SINCE_V4
|
||||
GTSAM_EXPORT inline Vector abs(const Vector& v){return v.cwiseAbs();}
|
||||
GTSAM_EXPORT inline Vector ediv(const Vector &a, const Vector &b) {assert (b.size()==a.size()); return a.cwiseQuotient(b);}
|
||||
GTSAM_EXPORT inline Vector esqrt(const Vector& v) { return v.cwiseSqrt();}
|
||||
GTSAM_EXPORT inline Vector emul(const Vector &a, const Vector &b) {assert (b.size()==a.size()); return a.cwiseProduct(b);}
|
||||
GTSAM_EXPORT inline double max(const Vector &a){return a.maxCoeff();}
|
||||
GTSAM_EXPORT inline double norm_2(const Vector& v) {return v.norm();}
|
||||
GTSAM_EXPORT inline Vector reciprocal(const Vector &a) {return a.array().inverse();}
|
||||
GTSAM_EXPORT inline Vector repeat(size_t n, double value) {return Vector::Constant(n, value);}
|
||||
GTSAM_EXPORT inline const Vector sub(const Vector &v, size_t i1, size_t i2) {return v.segment(i1,i2-i1);}
|
||||
GTSAM_EXPORT inline void subInsert(Vector& fullVector, const Vector& subVector, size_t i) {fullVector.segment(i, subVector.size()) = subVector;}
|
||||
GTSAM_EXPORT inline double sum(const Vector &a){return a.sum();}
|
||||
inline Vector abs(const Vector& v){return v.cwiseAbs();}
|
||||
inline Vector ediv(const Vector &a, const Vector &b) {assert (b.size()==a.size()); return a.cwiseQuotient(b);}
|
||||
inline Vector esqrt(const Vector& v) { return v.cwiseSqrt();}
|
||||
inline Vector emul(const Vector &a, const Vector &b) {assert (b.size()==a.size()); return a.cwiseProduct(b);}
|
||||
inline double max(const Vector &a){return a.maxCoeff();}
|
||||
inline double norm_2(const Vector& v) {return v.norm();}
|
||||
inline Vector reciprocal(const Vector &a) {return a.array().inverse();}
|
||||
inline Vector repeat(size_t n, double value) {return Vector::Constant(n, value);}
|
||||
inline const Vector sub(const Vector &v, size_t i1, size_t i2) {return v.segment(i1,i2-i1);}
|
||||
inline void subInsert(Vector& fullVector, const Vector& subVector, size_t i) {fullVector.segment(i, subVector.size()) = subVector;}
|
||||
inline double sum(const Vector &a){return a.sum();}
|
||||
|
||||
inline Vector delta(size_t n, size_t i, double value){ return Vector::Unit(n, i) * value;}
|
||||
inline Vector basis(size_t n, size_t i) { return delta(n, i, 1.0); }
|
||||
inline Vector zero(size_t n) { return Vector::Zero(n);}
|
||||
inline Vector ones(size_t n) { return Vector::Ones(n); }
|
||||
inline size_t dim(const Vector& v) { return v.size(); }
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace gtsam
|
||||
|
|
|
|||
Loading…
Reference in New Issue