Move Eigen magic inside function itself as Frank suggested.
							parent
							
								
									f5ce1d865e
								
							
						
					
					
						commit
						de27502738
					
				| 
						 | 
					@ -539,6 +539,11 @@ void HessianFactor::multiplyHessianAdd(double alpha, const VectorValues& x,
 | 
				
			||||||
void HessianFactor::multiplyHessianAdd(double alpha, const double* x,
 | 
					void HessianFactor::multiplyHessianAdd(double alpha, const double* x,
 | 
				
			||||||
    double* yvalues, vector<size_t> keys) const {
 | 
					    double* yvalues, vector<size_t> keys) const {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Use eigen magic to access raw memory
 | 
				
			||||||
 | 
					  typedef Eigen::Matrix<double, Eigen::Dynamic, 1> DVector;
 | 
				
			||||||
 | 
					  typedef Eigen::Map<DVector> DMap;
 | 
				
			||||||
 | 
					  typedef Eigen::Map<const DVector> ConstDMap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Create a vector of temporary y values, corresponding to rows i
 | 
					  // Create a vector of temporary y values, corresponding to rows i
 | 
				
			||||||
  vector<Vector> y;
 | 
					  vector<Vector> y;
 | 
				
			||||||
  y.reserve(size());
 | 
					  y.reserve(size());
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -142,11 +142,6 @@ namespace gtsam {
 | 
				
			||||||
    typedef SymmetricBlockMatrix::constBlock constBlock; ///< A block from the Hessian matrix (const version)
 | 
					    typedef SymmetricBlockMatrix::constBlock constBlock; ///< A block from the Hessian matrix (const version)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Use eigen magic to access raw memory
 | 
					 | 
				
			||||||
    typedef Eigen::Matrix<double, Eigen::Dynamic, 1> DVector;
 | 
					 | 
				
			||||||
    typedef Eigen::Map<DVector> DMap;
 | 
					 | 
				
			||||||
    typedef Eigen::Map<const DVector> ConstDMap;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /** default constructor for I/O */
 | 
					    /** default constructor for I/O */
 | 
				
			||||||
    HessianFactor();
 | 
					    HessianFactor();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -507,6 +507,12 @@ namespace gtsam {
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  void JacobianFactor::multiplyHessianAdd(double alpha, const double* x, double* y, std::vector<size_t> keys) const {
 | 
					  void JacobianFactor::multiplyHessianAdd(double alpha, const double* x, double* y, std::vector<size_t> keys) const {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						  // Use eigen magic to access raw memory
 | 
				
			||||||
 | 
						  typedef Eigen::Matrix<double, Eigen::Dynamic, 1> DVector;
 | 
				
			||||||
 | 
						  typedef Eigen::Map<DVector> DMap;
 | 
				
			||||||
 | 
						  typedef Eigen::Map<const DVector> ConstDMap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	  if (empty()) return;
 | 
						  if (empty()) return;
 | 
				
			||||||
	     Vector Ax = zero(Ab_.rows());
 | 
						     Vector Ax = zero(Ab_.rows());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -96,11 +96,6 @@ namespace gtsam {
 | 
				
			||||||
    typedef ABlock::ColXpr BVector;
 | 
					    typedef ABlock::ColXpr BVector;
 | 
				
			||||||
    typedef constABlock::ConstColXpr constBVector;
 | 
					    typedef constABlock::ConstColXpr constBVector;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Use eigen magic to access raw memory
 | 
					 | 
				
			||||||
     typedef Eigen::Matrix<double, Eigen::Dynamic, 1> DVector;
 | 
					 | 
				
			||||||
     typedef Eigen::Map<DVector> DMap;
 | 
					 | 
				
			||||||
     typedef Eigen::Map<const DVector> ConstDMap;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /** Convert from other GaussianFactor */
 | 
					    /** Convert from other GaussianFactor */
 | 
				
			||||||
    explicit JacobianFactor(const GaussianFactor& gf);
 | 
					    explicit JacobianFactor(const GaussianFactor& gf);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue