10 #ifndef EIGEN2_LEASTSQUARES_H    11 #define EIGEN2_LEASTSQUARES_H    84 template<
typename VectorType>
    90   typedef typename VectorType::Scalar Scalar;
    92   const int size = points[0]->size();
    94   HyperplaneType h(size);
    96   for(
int i = 0; i < funcOfOthers; i++)
    97     result->coeffRef(i) = - h.coeffs()[i] / h.coeffs()[funcOfOthers];
    98   for(
int i = funcOfOthers; i < size; i++)
    99     result->coeffRef(i) = - h.coeffs()[i+1] / h.coeffs()[funcOfOthers];
   129 template<
typename VectorType, 
typename HyperplaneType>
   132                    HyperplaneType *result,
   135   typedef typename VectorType::Scalar Scalar;
   139   int size = points[0]->size();
   140   ei_assert(size+1 == result->coeffs().size());
   143   VectorType mean = VectorType::Zero(size);
   144   for(
int i = 0; i < numPoints; ++i)
   145     mean += *(points[i]);
   149   CovMatrixType covMat = CovMatrixType::Zero(size, size);
   150   VectorType remean = VectorType::Zero(size);
   151   for(
int i = 0; i < numPoints; ++i)
   153     VectorType diff = (*(points[i]) - mean).conjugate();
   154     covMat += diff * diff.adjoint();
   165   result->offset() = - (result->normal().cwise()* mean).sum();
   170 #endif // EIGEN2_LEASTSQUARES_H 
Computes eigenvalues and eigenvectors of selfadjoint matrices. 
void fitHyperplane(int numPoints, VectorType **points, HyperplaneType *result, typename NumTraits< typename VectorType::Scalar >::Real *soundness=0)
void linearRegression(int numPoints, VectorType **points, VectorType *result, int funcOfOthers)
const MatrixType & eigenvectors() const 
Returns the eigenvectors of given matrix. 
The matrix class, also used for vectors and row-vectors. 
#define EIGEN_STATIC_ASSERT_VECTOR_ONLY(TYPE)
const RealVectorType & eigenvalues() const 
Returns the eigenvalues of given matrix.