Renabled BLAS using ATLAS for Linux, fixed a variety of annoying warnings
parent
fa954ab55e
commit
e8979dafad
17
.cproject
17
.cproject
|
@ -317,6 +317,7 @@
|
||||||
</target>
|
</target>
|
||||||
<target name="clean" path="wrap" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
<target name="clean" path="wrap" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
<buildCommand>make</buildCommand>
|
<buildCommand>make</buildCommand>
|
||||||
|
<buildArguments/>
|
||||||
<buildTarget>clean</buildTarget>
|
<buildTarget>clean</buildTarget>
|
||||||
<stopOnError>true</stopOnError>
|
<stopOnError>true</stopOnError>
|
||||||
<useDefaultCommand>true</useDefaultCommand>
|
<useDefaultCommand>true</useDefaultCommand>
|
||||||
|
@ -476,7 +477,6 @@
|
||||||
</target>
|
</target>
|
||||||
<target name="testBayesTree.run" path="cpp" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
<target name="testBayesTree.run" path="cpp" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
<buildCommand>make</buildCommand>
|
<buildCommand>make</buildCommand>
|
||||||
<buildArguments/>
|
|
||||||
<buildTarget>testBayesTree.run</buildTarget>
|
<buildTarget>testBayesTree.run</buildTarget>
|
||||||
<stopOnError>true</stopOnError>
|
<stopOnError>true</stopOnError>
|
||||||
<useDefaultCommand>false</useDefaultCommand>
|
<useDefaultCommand>false</useDefaultCommand>
|
||||||
|
@ -484,6 +484,7 @@
|
||||||
</target>
|
</target>
|
||||||
<target name="testSymbolicBayesNet.run" path="cpp" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
<target name="testSymbolicBayesNet.run" path="cpp" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
<buildCommand>make</buildCommand>
|
<buildCommand>make</buildCommand>
|
||||||
|
<buildArguments/>
|
||||||
<buildTarget>testSymbolicBayesNet.run</buildTarget>
|
<buildTarget>testSymbolicBayesNet.run</buildTarget>
|
||||||
<stopOnError>true</stopOnError>
|
<stopOnError>true</stopOnError>
|
||||||
<useDefaultCommand>false</useDefaultCommand>
|
<useDefaultCommand>false</useDefaultCommand>
|
||||||
|
@ -491,7 +492,6 @@
|
||||||
</target>
|
</target>
|
||||||
<target name="testSymbolicFactorGraph.run" path="cpp" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
<target name="testSymbolicFactorGraph.run" path="cpp" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
<buildCommand>make</buildCommand>
|
<buildCommand>make</buildCommand>
|
||||||
<buildArguments/>
|
|
||||||
<buildTarget>testSymbolicFactorGraph.run</buildTarget>
|
<buildTarget>testSymbolicFactorGraph.run</buildTarget>
|
||||||
<stopOnError>true</stopOnError>
|
<stopOnError>true</stopOnError>
|
||||||
<useDefaultCommand>false</useDefaultCommand>
|
<useDefaultCommand>false</useDefaultCommand>
|
||||||
|
@ -683,7 +683,6 @@
|
||||||
</target>
|
</target>
|
||||||
<target name="testGraph.run" path="cpp" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
<target name="testGraph.run" path="cpp" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
<buildCommand>make</buildCommand>
|
<buildCommand>make</buildCommand>
|
||||||
<buildArguments/>
|
|
||||||
<buildTarget>testGraph.run</buildTarget>
|
<buildTarget>testGraph.run</buildTarget>
|
||||||
<stopOnError>true</stopOnError>
|
<stopOnError>true</stopOnError>
|
||||||
<useDefaultCommand>false</useDefaultCommand>
|
<useDefaultCommand>false</useDefaultCommand>
|
||||||
|
@ -739,6 +738,7 @@
|
||||||
</target>
|
</target>
|
||||||
<target name="testSimulated2D.run" path="cpp" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
<target name="testSimulated2D.run" path="cpp" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
<buildCommand>make</buildCommand>
|
<buildCommand>make</buildCommand>
|
||||||
|
<buildArguments/>
|
||||||
<buildTarget>testSimulated2D.run</buildTarget>
|
<buildTarget>testSimulated2D.run</buildTarget>
|
||||||
<stopOnError>true</stopOnError>
|
<stopOnError>true</stopOnError>
|
||||||
<useDefaultCommand>false</useDefaultCommand>
|
<useDefaultCommand>false</useDefaultCommand>
|
||||||
|
@ -786,7 +786,6 @@
|
||||||
</target>
|
</target>
|
||||||
<target name="testErrors.run" path="cpp" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
<target name="testErrors.run" path="cpp" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
<buildCommand>make</buildCommand>
|
<buildCommand>make</buildCommand>
|
||||||
<buildArguments/>
|
|
||||||
<buildTarget>testErrors.run</buildTarget>
|
<buildTarget>testErrors.run</buildTarget>
|
||||||
<stopOnError>true</stopOnError>
|
<stopOnError>true</stopOnError>
|
||||||
<useDefaultCommand>false</useDefaultCommand>
|
<useDefaultCommand>false</useDefaultCommand>
|
||||||
|
@ -794,7 +793,6 @@
|
||||||
</target>
|
</target>
|
||||||
<target name="testDSF.run" path="cpp" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
<target name="testDSF.run" path="cpp" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
<buildCommand>make</buildCommand>
|
<buildCommand>make</buildCommand>
|
||||||
<buildArguments/>
|
|
||||||
<buildTarget>testDSF.run</buildTarget>
|
<buildTarget>testDSF.run</buildTarget>
|
||||||
<stopOnError>true</stopOnError>
|
<stopOnError>true</stopOnError>
|
||||||
<useDefaultCommand>true</useDefaultCommand>
|
<useDefaultCommand>true</useDefaultCommand>
|
||||||
|
@ -810,12 +808,19 @@
|
||||||
</target>
|
</target>
|
||||||
<target name="testConstraintOptimizer.run" path="cpp" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
<target name="testConstraintOptimizer.run" path="cpp" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
<buildCommand>make</buildCommand>
|
<buildCommand>make</buildCommand>
|
||||||
<buildArguments/>
|
|
||||||
<buildTarget>testConstraintOptimizer.run</buildTarget>
|
<buildTarget>testConstraintOptimizer.run</buildTarget>
|
||||||
<stopOnError>true</stopOnError>
|
<stopOnError>true</stopOnError>
|
||||||
<useDefaultCommand>true</useDefaultCommand>
|
<useDefaultCommand>true</useDefaultCommand>
|
||||||
<runAllBuilders>true</runAllBuilders>
|
<runAllBuilders>true</runAllBuilders>
|
||||||
</target>
|
</target>
|
||||||
|
<target name="testBTree.run" path="cpp" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
|
<buildCommand>make</buildCommand>
|
||||||
|
<buildArguments/>
|
||||||
|
<buildTarget>testBTree.run</buildTarget>
|
||||||
|
<stopOnError>true</stopOnError>
|
||||||
|
<useDefaultCommand>true</useDefaultCommand>
|
||||||
|
<runAllBuilders>true</runAllBuilders>
|
||||||
|
</target>
|
||||||
<target name="install" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
<target name="install" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
<buildCommand>make</buildCommand>
|
<buildCommand>make</buildCommand>
|
||||||
<buildArguments>-j2</buildArguments>
|
<buildArguments>-j2</buildArguments>
|
||||||
|
|
|
@ -41,15 +41,15 @@ namespace gtsam {
|
||||||
* leaf node with height 1
|
* leaf node with height 1
|
||||||
*/
|
*/
|
||||||
Node(const value_type& keyValue) :
|
Node(const value_type& keyValue) :
|
||||||
keyValue_(keyValue), height_(1) {
|
height_(1), keyValue_(keyValue) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a node from two subtrees and a key value pair
|
* Create a node from two subtrees and a key value pair
|
||||||
*/
|
*/
|
||||||
Node(const BTree& l, const value_type& keyValue, const BTree& r) :
|
Node(const BTree& l, const value_type& keyValue, const BTree& r) :
|
||||||
left(l), keyValue_(keyValue), right(r),
|
height_(l.height() >= r.height() ? l.height() + 1 : r.height() + 1),
|
||||||
height_(l.height() >= r.height() ? l.height() + 1 : r.height() + 1) {
|
keyValue_(keyValue), left(l), right(r) {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const Key& key() const { return keyValue_.first;}
|
inline const Key& key() const { return keyValue_.first;}
|
||||||
|
|
|
@ -56,7 +56,7 @@ namespace gtsam {
|
||||||
BinaryConditional(const Symbol& key, const Symbol& parent, const std::vector<double>& cpt) :
|
BinaryConditional(const Symbol& key, const Symbol& parent, const std::vector<double>& cpt) :
|
||||||
Conditional(key) {
|
Conditional(key) {
|
||||||
parents_.push_back(parent);
|
parents_.push_back(parent);
|
||||||
for( int i = 0 ; i < cpt.size() ; i++ )
|
for( size_t i = 0 ; i < cpt.size() ; i++ )
|
||||||
cpt_.push_back(1-cpt[i]); // p(!x|parents)
|
cpt_.push_back(1-cpt[i]); // p(!x|parents)
|
||||||
cpt_.insert(cpt_.end(),cpt.begin(),cpt.end()); // p(x|parents)
|
cpt_.insert(cpt_.end(),cpt.begin(),cpt.end()); // p(x|parents)
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,7 @@ void FactorGraph<Factor>::push_back(const FactorGraph<Factor>& factors) {
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
template<class Factor>
|
template<class Factor>
|
||||||
void FactorGraph<Factor>::replace(int index, sharedFactor factor) {
|
void FactorGraph<Factor>::replace(size_t index, sharedFactor factor) {
|
||||||
if(index >= factors_.size())
|
if(index >= factors_.size())
|
||||||
throw invalid_argument(boost::str(boost::format(
|
throw invalid_argument(boost::str(boost::format(
|
||||||
"Factor graph does not contain a factor with index %d.") % index));
|
"Factor graph does not contain a factor with index %d.") % index));
|
||||||
|
@ -321,7 +321,7 @@ template<class Factor> void FactorGraph<Factor>::checkGraphConsistency() const {
|
||||||
|
|
||||||
// Make sure each factor listed for a variable actually involves that variable
|
// Make sure each factor listed for a variable actually involves that variable
|
||||||
BOOST_FOREACH(const SymbolMap<list<int> >::value_type& var, indices_) {
|
BOOST_FOREACH(const SymbolMap<list<int> >::value_type& var, indices_) {
|
||||||
BOOST_FOREACH(int i, var.second) {
|
BOOST_FOREACH(size_t i, var.second) {
|
||||||
if(i >= factors_.size()) {
|
if(i >= factors_.size()) {
|
||||||
cout << "*** Factor graph inconsistency: " << (string)var.first << " lists factor " <<
|
cout << "*** Factor graph inconsistency: " << (string)var.first << " lists factor " <<
|
||||||
i << " but the graph does not contain this many factors." << endl;
|
i << " but the graph does not contain this many factors." << endl;
|
||||||
|
@ -380,8 +380,8 @@ void FactorGraph<Factor>::split(const PredecessorMap<Key>& tree, FactorGraph<Fac
|
||||||
Key key1 = factor2->key1();
|
Key key1 = factor2->key1();
|
||||||
Key key2 = factor2->key2();
|
Key key2 = factor2->key2();
|
||||||
// if the tree contains the key
|
// if the tree contains the key
|
||||||
if (tree.find(key1) != tree.end() && tree.find(key1)->second.compare(key2) == 0 ||
|
if ((tree.find(key1) != tree.end() && tree.find(key1)->second.compare(key2) == 0) ||
|
||||||
tree.find(key2) != tree.end() && tree.find(key2)->second.compare(key1) == 0)
|
(tree.find(key2) != tree.end() && tree.find(key2)->second.compare(key1) == 0))
|
||||||
Ab1.push_back(factor2);
|
Ab1.push_back(factor2);
|
||||||
else
|
else
|
||||||
Ab2.push_back(factor2);
|
Ab2.push_back(factor2);
|
||||||
|
|
|
@ -87,7 +87,7 @@ namespace gtsam {
|
||||||
void push_back(const FactorGraph<Factor>& factors);
|
void push_back(const FactorGraph<Factor>& factors);
|
||||||
|
|
||||||
/** replace a factor by index */
|
/** replace a factor by index */
|
||||||
void replace(int index, sharedFactor factor);
|
void replace(size_t index, sharedFactor factor);
|
||||||
|
|
||||||
/** return keys in some random order */
|
/** return keys in some random order */
|
||||||
Ordering keys() const;
|
Ordering keys() const;
|
||||||
|
|
|
@ -59,7 +59,6 @@ namespace gtsam {
|
||||||
for ( rit=bayesNet.rbegin(); rit != bayesNet.rend(); ++rit )
|
for ( rit=bayesNet.rbegin(); rit != bayesNet.rend(); ++rit )
|
||||||
this->insert(*rit, index);
|
this->insert(*rit, index);
|
||||||
|
|
||||||
int count = 0;
|
|
||||||
// add orphans to the bottom of the new tree
|
// add orphans to the bottom of the new tree
|
||||||
BOOST_FOREACH(sharedClique orphan, orphans) {
|
BOOST_FOREACH(sharedClique orphan, orphans) {
|
||||||
|
|
||||||
|
|
|
@ -306,8 +306,8 @@ AM_LDFLAGS = -L../CppUnitLite -lCppUnitLite $(BOOST_LDFLAGS) $(boost_serializati
|
||||||
if USE_BLAS_LINUX
|
if USE_BLAS_LINUX
|
||||||
AM_CXXFLAGS += -DGT_USE_CBLAS
|
AM_CXXFLAGS += -DGT_USE_CBLAS
|
||||||
libgtsam_la_CPPFLAGS += -DGT_USE_CBLAS
|
libgtsam_la_CPPFLAGS += -DGT_USE_CBLAS
|
||||||
AM_LDFLAGS += $(BLAS_LIBS) $(LIBS) $(FLIBS)
|
AM_LDFLAGS += -lcblas -latlas # If getting from script: $(BLAS_LIBS) $(LIBS) $(FLIBS)
|
||||||
libgtsam_la_LDFLAGS += $(BLAS_LIBS) $(LIBS) $(FLIBS)
|
libgtsam_la_LDFLAGS += -lcblas -latlas # $(BLAS_LIBS) $(LIBS) $(FLIBS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if USE_BLAS_MACOS
|
if USE_BLAS_MACOS
|
||||||
|
|
|
@ -268,10 +268,10 @@ void transposeMultiplyAdd(double alpha, const Matrix& A, const Vector& e, SubVec
|
||||||
// ublas x += prod(trans(A),e) is terribly slow
|
// ublas x += prod(trans(A),e) is terribly slow
|
||||||
// TODO: use BLAS
|
// TODO: use BLAS
|
||||||
size_t m = A.size1(), n = A.size2();
|
size_t m = A.size1(), n = A.size2();
|
||||||
for (int j = 0; j < n; j++) {
|
for (size_t j = 0; j < n; j++) {
|
||||||
const double * ei = e.data().begin();
|
const double * ei = e.data().begin();
|
||||||
const double * aij = A.data().begin() + j;
|
const double * aij = A.data().begin() + j;
|
||||||
for (int i = 0; i < m; i++, aij+=n, ei++)
|
for (size_t i = 0; i < m; i++, aij+=n, ei++)
|
||||||
x(j) += alpha * (*aij) * (*ei);
|
x(j) += alpha * (*aij) * (*ei);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -293,13 +293,6 @@ Vector column_(const Matrix& A, size_t j) {
|
||||||
// throw invalid_argument("Column index out of bounds!");
|
// throw invalid_argument("Column index out of bounds!");
|
||||||
|
|
||||||
return column(A,j); // real boost version
|
return column(A,j); // real boost version
|
||||||
|
|
||||||
// TODO: improve this
|
|
||||||
// size_t m = A.size1();
|
|
||||||
// Vector a(m);
|
|
||||||
// for (size_t i=0; i<m; ++i)
|
|
||||||
// a(i) = A(i,j);
|
|
||||||
// return a;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
@ -348,7 +341,7 @@ Matrix sub(const Matrix& A, size_t i1, size_t i2, size_t j1, size_t j2) {
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
void insertSub(Matrix& big, const Matrix& small, size_t i, size_t j) {
|
void insertSub(Matrix& big, const Matrix& small, size_t i, size_t j) {
|
||||||
// direct pointer method
|
// direct pointer method
|
||||||
size_t ib = big.size1(), jb = big.size2(),
|
size_t jb = big.size2(),
|
||||||
is = small.size1(), js = small.size2();
|
is = small.size1(), js = small.size2();
|
||||||
|
|
||||||
// pointer to start of window in big
|
// pointer to start of window in big
|
||||||
|
@ -472,13 +465,13 @@ inline void householder_update_manual(Matrix &A, int j, double beta, const Vecto
|
||||||
}
|
}
|
||||||
|
|
||||||
void householder_update(Matrix &A, int j, double beta, const Vector& vjm) {
|
void householder_update(Matrix &A, int j, double beta, const Vector& vjm) {
|
||||||
const size_t m = A.size1(), n = A.size2();
|
|
||||||
#if defined GT_USE_CBLAS
|
#if defined GT_USE_CBLAS
|
||||||
|
|
||||||
// CBLAS version not working, using manual approach
|
// CBLAS version not working, using manual approach
|
||||||
householder_update_manual(A,j,beta,vjm);
|
householder_update_manual(A,j,beta,vjm);
|
||||||
|
|
||||||
// // straight atlas version
|
// // straight atlas version
|
||||||
|
// const size_t m = A.size1(), n = A.size2();
|
||||||
// const size_t mj = m-j;
|
// const size_t mj = m-j;
|
||||||
//
|
//
|
||||||
// // find pointers to the data
|
// // find pointers to the data
|
||||||
|
@ -659,8 +652,9 @@ void householder(Matrix &A, size_t k) {
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
Vector backSubstituteUpper(const Matrix& U, const Vector& b, bool unit) {
|
Vector backSubstituteUpper(const Matrix& U, const Vector& b, bool unit) {
|
||||||
size_t m = U.size1(), n = U.size2();
|
size_t n = U.size2();
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
size_t m = U.size1();
|
||||||
if (m!=n)
|
if (m!=n)
|
||||||
throw invalid_argument("backSubstituteUpper: U must be square");
|
throw invalid_argument("backSubstituteUpper: U must be square");
|
||||||
#endif
|
#endif
|
||||||
|
@ -679,8 +673,9 @@ Vector backSubstituteUpper(const Matrix& U, const Vector& b, bool unit) {
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
Vector backSubstituteUpper(const Vector& b, const Matrix& U, bool unit) {
|
Vector backSubstituteUpper(const Vector& b, const Matrix& U, bool unit) {
|
||||||
size_t m = U.size1(), n = U.size2();
|
size_t n = U.size2();
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
size_t m = U.size1();
|
||||||
if (m!=n)
|
if (m!=n)
|
||||||
throw invalid_argument("backSubstituteUpper: U must be square");
|
throw invalid_argument("backSubstituteUpper: U must be square");
|
||||||
#endif
|
#endif
|
||||||
|
@ -699,8 +694,9 @@ Vector backSubstituteUpper(const Vector& b, const Matrix& U, bool unit) {
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
Vector backSubstituteLower(const Matrix& L, const Vector& b, bool unit) {
|
Vector backSubstituteLower(const Matrix& L, const Vector& b, bool unit) {
|
||||||
size_t m = L.size1(), n = L.size2();
|
size_t n = L.size2();
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
size_t m = U.size1();
|
||||||
if (m!=n)
|
if (m!=n)
|
||||||
throw invalid_argument("backSubstituteLower: L must be square");
|
throw invalid_argument("backSubstituteLower: L must be square");
|
||||||
#endif
|
#endif
|
||||||
|
@ -750,11 +746,12 @@ Matrix collect(const std::vector<const Matrix *>& matrices, size_t m, size_t n)
|
||||||
// if we have known and constant dimensions, use them
|
// if we have known and constant dimensions, use them
|
||||||
size_t dimA1 = m;
|
size_t dimA1 = m;
|
||||||
size_t dimA2 = n*matrices.size();
|
size_t dimA2 = n*matrices.size();
|
||||||
if (!m && !n)
|
if (!m && !n) {
|
||||||
BOOST_FOREACH(const Matrix* M, matrices) {
|
BOOST_FOREACH(const Matrix* M, matrices) {
|
||||||
dimA1 = M->size1(); // TODO: should check if all the same !
|
dimA1 = M->size1(); // TODO: should check if all the same !
|
||||||
dimA2 += M->size2();
|
dimA2 += M->size2();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// memcpy version
|
// memcpy version
|
||||||
Matrix A(dimA1, dimA2);
|
Matrix A(dimA1, dimA2);
|
||||||
|
@ -896,11 +893,11 @@ Matrix RtR(const Matrix &A)
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
Vector solve_ldl(const Matrix& M, const Vector& rhs) {
|
Vector solve_ldl(const Matrix& M, const Vector& rhs) {
|
||||||
|
|
||||||
int N = M.size1(); // size of the matrix
|
unsigned int N = M.size1(); // size of the matrix
|
||||||
|
|
||||||
// count the nonzero entries above diagonal
|
// count the nonzero entries above diagonal
|
||||||
double thresh = 1e-9;
|
double thresh = 1e-9;
|
||||||
size_t nrANZ = 0; // # of nonzeros on diagonal and upper triangular part of A
|
unsigned int nrANZ = 0; // # of nonzeros on diagonal and upper triangular part of A
|
||||||
for (size_t i=0; i<N; ++i) // rows
|
for (size_t i=0; i<N; ++i) // rows
|
||||||
for (size_t j=i; j<N; ++j) // columns
|
for (size_t j=i; j<N; ++j) // columns
|
||||||
if (fabs(M(i,j)) > thresh)
|
if (fabs(M(i,j)) > thresh)
|
||||||
|
@ -950,7 +947,7 @@ Vector solve_ldl(const Matrix& M, const Vector& rhs) {
|
||||||
double * Lx = new double[nrLNZ];
|
double * Lx = new double[nrLNZ];
|
||||||
int * Li = new int [nrLNZ];
|
int * Li = new int [nrLNZ];
|
||||||
|
|
||||||
int d = LDL_numeric (N, Ap, Ai, Ax, Lp, Parent, Lnz, Li, Lx, D, Y, Pattern,
|
size_t d = LDL_numeric (N, Ap, Ai, Ax, Lp, Parent, Lnz, Li, Lx, D, Y, Pattern,
|
||||||
Flag, NULL, NULL);
|
Flag, NULL, NULL);
|
||||||
|
|
||||||
if (d == N) {
|
if (d == N) {
|
||||||
|
|
|
@ -49,7 +49,7 @@ NonlinearConstraint1<Config, Key, X>::NonlinearConstraint1(
|
||||||
const LagrangeKey& lagrange_key,
|
const LagrangeKey& lagrange_key,
|
||||||
bool isEquality) :
|
bool isEquality) :
|
||||||
NonlinearConstraint<Config>(lagrange_key, dim_constraint, isEquality),
|
NonlinearConstraint<Config>(lagrange_key, dim_constraint, isEquality),
|
||||||
g_(boost::bind(g, _1)), G_(boost::bind(gradG, _1)), key_(key)
|
G_(boost::bind(gradG, _1)), g_(boost::bind(g, _1)), key_(key)
|
||||||
{
|
{
|
||||||
this->keys_.push_back(key);
|
this->keys_.push_back(key);
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ NonlinearConstraint1<Config, Key, X>::NonlinearConstraint1(
|
||||||
const LagrangeKey& lagrange_key,
|
const LagrangeKey& lagrange_key,
|
||||||
bool isEquality) :
|
bool isEquality) :
|
||||||
NonlinearConstraint<Config>(lagrange_key, dim_constraint, isEquality),
|
NonlinearConstraint<Config>(lagrange_key, dim_constraint, isEquality),
|
||||||
g_(g), G_(gradG), key_(key)
|
G_(gradG), g_(g), key_(key)
|
||||||
{
|
{
|
||||||
this->keys_.push_back(key);
|
this->keys_.push_back(key);
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ NonlinearConstraint2<Config, Key1, X1, Key2, X2>::NonlinearConstraint2(
|
||||||
const LagrangeKey& lagrange_key,
|
const LagrangeKey& lagrange_key,
|
||||||
bool isEquality) :
|
bool isEquality) :
|
||||||
NonlinearConstraint<Config>(lagrange_key, dim_constraint, isEquality),
|
NonlinearConstraint<Config>(lagrange_key, dim_constraint, isEquality),
|
||||||
g_(boost::bind(g, _1)), G1_(boost::bind(G1, _1)), G2_(boost::bind(G2, _1)),
|
G1_(boost::bind(G1, _1)), G2_(boost::bind(G2, _1)), g_(boost::bind(g, _1)),
|
||||||
key1_(key1), key2_(key2)
|
key1_(key1), key2_(key2)
|
||||||
{
|
{
|
||||||
this->keys_.push_back(key1);
|
this->keys_.push_back(key1);
|
||||||
|
@ -163,7 +163,7 @@ NonlinearConstraint2<Config, Key1, X1, Key2, X2>::NonlinearConstraint2(
|
||||||
const LagrangeKey& lagrange_key,
|
const LagrangeKey& lagrange_key,
|
||||||
bool isEquality) :
|
bool isEquality) :
|
||||||
NonlinearConstraint<Config>(lagrange_key, dim_constraint, isEquality),
|
NonlinearConstraint<Config>(lagrange_key, dim_constraint, isEquality),
|
||||||
g_(g), G1_(G1), G2_(G2),
|
G1_(G1), G2_(G2), g_(g),
|
||||||
key1_(key1), key2_(key2)
|
key1_(key1), key2_(key2)
|
||||||
{
|
{
|
||||||
this->keys_.push_back(key1);
|
this->keys_.push_back(key1);
|
||||||
|
|
|
@ -67,9 +67,8 @@ namespace simulated3D {
|
||||||
|
|
||||||
Simulated3DMeasurement(const Vector& z,
|
Simulated3DMeasurement(const Vector& z,
|
||||||
const SharedGaussian& model, PoseKey& j1, PointKey j2) :
|
const SharedGaussian& model, PoseKey& j1, PointKey j2) :
|
||||||
z_(z),
|
|
||||||
NonlinearFactor2<VectorConfig, PoseKey, Vector, PointKey, Vector> (
|
NonlinearFactor2<VectorConfig, PoseKey, Vector, PointKey, Vector> (
|
||||||
model, j1, j2) {
|
model, j1, j2), z_(z) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector evaluateError(const Vector& x1, const Vector& x2, boost::optional<
|
Vector evaluateError(const Vector& x1, const Vector& x2, boost::optional<
|
||||||
|
|
|
@ -22,7 +22,6 @@ namespace gtsam {
|
||||||
*/
|
*/
|
||||||
template<class X>
|
template<class X>
|
||||||
Vector numericalGradient(double (*h)(const X&), const X& x, double delta=1e-5) {
|
Vector numericalGradient(double (*h)(const X&), const X& x, double delta=1e-5) {
|
||||||
double hx = h(x);
|
|
||||||
double factor = 1.0/(2.0*delta);
|
double factor = 1.0/(2.0*delta);
|
||||||
const size_t n = x.dim();
|
const size_t n = x.dim();
|
||||||
Vector d(n,0.0), g(n,0.0);
|
Vector d(n,0.0), g(n,0.0);
|
||||||
|
|
|
@ -78,7 +78,7 @@ namespace gtsam {
|
||||||
|
|
||||||
GenericOdometry(const Point2& z, const SharedGaussian& model,
|
GenericOdometry(const Point2& z, const SharedGaussian& model,
|
||||||
const Key& i1, const Key& i2) :
|
const Key& i1, const Key& i2) :
|
||||||
z_(z), NonlinearFactor2<Cfg, Key, Point2, Key, Point2> (model, i1, i2) {
|
NonlinearFactor2<Cfg, Key, Point2, Key, Point2> (model, i1, i2), z_(z) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector evaluateError(const Point2& x1, const Point2& x2, boost::optional<
|
Vector evaluateError(const Point2& x1, const Point2& x2, boost::optional<
|
||||||
|
@ -100,7 +100,7 @@ namespace gtsam {
|
||||||
|
|
||||||
GenericMeasurement(const Point2& z, const SharedGaussian& model,
|
GenericMeasurement(const Point2& z, const SharedGaussian& model,
|
||||||
const XKey& i, const LKey& j) :
|
const XKey& i, const LKey& j) :
|
||||||
z_(z), NonlinearFactor2<Cfg, XKey, Point2, LKey, Point2> (model, i, j) {
|
NonlinearFactor2<Cfg, XKey, Point2, LKey, Point2> (model, i, j), z_(z) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector evaluateError(const Point2& x1, const Point2& x2, boost::optional<
|
Vector evaluateError(const Point2& x1, const Point2& x2, boost::optional<
|
||||||
|
|
|
@ -460,8 +460,8 @@ TEST( GaussianFactorGraph, combine)
|
||||||
GaussianFactorGraph fg2 = createGaussianFactorGraph();
|
GaussianFactorGraph fg2 = createGaussianFactorGraph();
|
||||||
|
|
||||||
// get sizes
|
// get sizes
|
||||||
int size1 = fg1.size();
|
size_t size1 = fg1.size();
|
||||||
int size2 = fg2.size();
|
size_t size2 = fg2.size();
|
||||||
|
|
||||||
// combine them
|
// combine them
|
||||||
fg1.combine(fg2);
|
fg1.combine(fg2);
|
||||||
|
@ -479,8 +479,8 @@ TEST( GaussianFactorGraph, combine2)
|
||||||
GaussianFactorGraph fg2 = createGaussianFactorGraph();
|
GaussianFactorGraph fg2 = createGaussianFactorGraph();
|
||||||
|
|
||||||
// get sizes
|
// get sizes
|
||||||
int size1 = fg1.size();
|
size_t size1 = fg1.size();
|
||||||
int size2 = fg2.size();
|
size_t size2 = fg2.size();
|
||||||
|
|
||||||
// combine them
|
// combine them
|
||||||
GaussianFactorGraph fg3 = GaussianFactorGraph::combine2(fg1, fg2);
|
GaussianFactorGraph fg3 = GaussianFactorGraph::combine2(fg1, fg2);
|
||||||
|
@ -491,7 +491,7 @@ TEST( GaussianFactorGraph, combine2)
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
// print a vector of ints if needed for debugging
|
// print a vector of ints if needed for debugging
|
||||||
void print(vector<int> v) {
|
void print(vector<int> v) {
|
||||||
for (int k = 0; k < v.size(); k++)
|
for (size_t k = 0; k < v.size(); k++)
|
||||||
cout << v[k] << " ";
|
cout << v[k] << " ";
|
||||||
cout << endl;
|
cout << endl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -795,19 +795,19 @@ TEST( matrix, svd_sort )
|
||||||
// update A, b
|
// update A, b
|
||||||
// A' \define A_{S}-ar and b'\define b-ad
|
// A' \define A_{S}-ar and b'\define b-ad
|
||||||
// __attribute__ ((noinline)) // uncomment to prevent inlining when profiling
|
// __attribute__ ((noinline)) // uncomment to prevent inlining when profiling
|
||||||
static void updateAb(Matrix& A, Vector& b, int j, const Vector& a,
|
//static void updateAb(Matrix& A, Vector& b, int j, const Vector& a,
|
||||||
const Vector& r, double d) {
|
// const Vector& r, double d) {
|
||||||
const size_t m = A.size1(), n = A.size2();
|
// const size_t m = A.size1(), n = A.size2();
|
||||||
for (int i = 0; i < m; i++) { // update all rows
|
// for (int i = 0; i < m; i++) { // update all rows
|
||||||
double ai = a(i);
|
// double ai = a(i);
|
||||||
b(i) -= ai * d;
|
// b(i) -= ai * d;
|
||||||
double *Aij = A.data().begin() + i * n + j + 1;
|
// double *Aij = A.data().begin() + i * n + j + 1;
|
||||||
const double *rptr = r.data().begin() + j + 1;
|
// const double *rptr = r.data().begin() + j + 1;
|
||||||
// A(i,j+1:end) -= ai*r(j+1:end)
|
// // A(i,j+1:end) -= ai*r(j+1:end)
|
||||||
for (int j2 = j + 1; j2 < n; j2++, Aij++, rptr++)
|
// for (int j2 = j + 1; j2 < n; j2++, Aij++, rptr++)
|
||||||
*Aij -= ai * (*rptr);
|
// *Aij -= ai * (*rptr);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
TEST( matrix, weighted_elimination )
|
TEST( matrix, weighted_elimination )
|
||||||
|
|
|
@ -53,7 +53,6 @@ TEST(NoiseModel, constructors)
|
||||||
m.push_back(Isotropic::Precision(3, prc));
|
m.push_back(Isotropic::Precision(3, prc));
|
||||||
|
|
||||||
// test whiten
|
// test whiten
|
||||||
int i=0;
|
|
||||||
BOOST_FOREACH(Gaussian::shared_ptr mi, m)
|
BOOST_FOREACH(Gaussian::shared_ptr mi, m)
|
||||||
CHECK(assert_equal(whitened,mi->whiten(unwhitened)));
|
CHECK(assert_equal(whitened,mi->whiten(unwhitened)));
|
||||||
|
|
||||||
|
|
|
@ -139,7 +139,6 @@ namespace test2 {
|
||||||
|
|
||||||
/** jacobian for y, jacobianG(x,y) in y: -1 */
|
/** jacobian for y, jacobianG(x,y) in y: -1 */
|
||||||
Matrix G2(const VecConfig& config, const list<Key>& keys) {
|
Matrix G2(const VecConfig& config, const list<Key>& keys) {
|
||||||
double x = config[keys.back()](0);
|
|
||||||
return Matrix_(1, 1, -1.0);
|
return Matrix_(1, 1, -1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,6 @@ TEST( Pose2Graph, linearization )
|
||||||
0.0, 2.0, 0.0,
|
0.0, 2.0, 0.0,
|
||||||
0.0, 0.0, 10.0);
|
0.0, 0.0, 10.0);
|
||||||
|
|
||||||
double sigma = 1;
|
|
||||||
Vector b = Vector_(3,-0.1/sx,0.1/sy,0.0);
|
Vector b = Vector_(3,-0.1/sx,0.1/sy,0.0);
|
||||||
SharedDiagonal probModel1 = noiseModel::Unit::Create(3);
|
SharedDiagonal probModel1 = noiseModel::Unit::Create(3);
|
||||||
lfg_expected.add("x1", A1, "x2", A2, b, probModel1);
|
lfg_expected.add("x1", A1, "x2", A2, b, probModel1);
|
||||||
|
|
|
@ -915,7 +915,6 @@ boost::shared_ptr<Graph2D> linearMapWarpGraph() {
|
||||||
|
|
||||||
/* ********************************************************************* */
|
/* ********************************************************************* */
|
||||||
TEST ( SQPOptimizer, map_warp_initLam ) {
|
TEST ( SQPOptimizer, map_warp_initLam ) {
|
||||||
bool verbose = false;
|
|
||||||
// get a graph
|
// get a graph
|
||||||
boost::shared_ptr<Graph2D> graph = linearMapWarpGraph();
|
boost::shared_ptr<Graph2D> graph = linearMapWarpGraph();
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ namespace gtsam { namespace visualSLAM {
|
||||||
GenericProjectionFactor(const Point2& z,
|
GenericProjectionFactor(const Point2& z,
|
||||||
const SharedGaussian& model, PosK j_pose,
|
const SharedGaussian& model, PosK j_pose,
|
||||||
LmK j_landmark, const shared_ptrK& K) :
|
LmK j_landmark, const shared_ptrK& K) :
|
||||||
z_(z), K_(K), Base(model, j_pose, j_landmark) {
|
Base(model, j_pose, j_landmark), z_(z), K_(K) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue