const reference and minor updates
							parent
							
								
									44ec8ba8c0
								
							
						
					
					
						commit
						620ca2bd3a
					
				|  | @ -136,20 +136,18 @@ bool Gaussian::equals(const Base& expected, double tol) const { | ||||||
|   const Gaussian* p = dynamic_cast<const Gaussian*> (&expected); |   const Gaussian* p = dynamic_cast<const Gaussian*> (&expected); | ||||||
|   if (p == NULL) return false; |   if (p == NULL) return false; | ||||||
|   if (typeid(*this) != typeid(*p)) return false; |   if (typeid(*this) != typeid(*p)) return false; | ||||||
|   //TODO(Alex);
 |  | ||||||
|   //if (!sqrt_information_) return true;
 |  | ||||||
|   return equal_with_abs_tol(R(), p->R(), sqrt(tol)); |   return equal_with_abs_tol(R(), p->R(), sqrt(tol)); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /* ************************************************************************* */ | /* ************************************************************************* */ | ||||||
| Matrix Gaussian::covariance() const { | Matrix Gaussian::covariance() const { | ||||||
|   // Uses a fast version of `covariance = information().inverse();`
 |   // Uses a fast version of `covariance = information().inverse();`
 | ||||||
|   Matrix R = this->R(); |   const Matrix& R = this->R(); | ||||||
|   Matrix I = Matrix::Identity(R.rows(), R.cols()); |   Matrix I = Matrix::Identity(R.rows(), R.cols()); | ||||||
|   // Fast inverse of upper-triangular matrix R using forward-substitution
 |   // Fast inverse of upper-triangular matrix R using forward-substitution
 | ||||||
|   Matrix Rinv = R.triangularView<Eigen::Upper>().solve(I); |   Matrix Rinv = R.triangularView<Eigen::Upper>().solve(I); | ||||||
|   // (R' * R)^{-1} = R^{-1} * R^{-1}'
 |   // (R' * R)^{-1} = R^{-1} * R^{-1}'
 | ||||||
|   return (Rinv * Rinv.transpose()); |   return Rinv * Rinv.transpose(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /* ************************************************************************* */ | /* ************************************************************************* */ | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue