* add Regression module, from eigen1, improved, with doc and unit-test.

* fix .normalized() so that Random().normalized() works; since the return
type became complicated to write down i just let it return an actual
vector, perhaps not optimal.
* add Sparse/CMakeLists.txt. I suppose that it was intentional that it
didn't have CMakeLists, but in <=2.0 releases I'll just manually remove
Sparse.
This commit is contained in:
Benoit Jacob
2008-08-11 02:25:40 +00:00
parent 55e8d670ce
commit 17ec407ccd
14 changed files with 369 additions and 12 deletions

View File

@@ -292,10 +292,13 @@ inline typename NumTraits<typename ei_traits<Derived>::Scalar>::Real MatrixBase<
* \sa norm(), normalize()
*/
template<typename Derived>
inline const typename MatrixBase<Derived>::ScalarQuotient1ReturnType
inline const typename MatrixBase<Derived>::EvalType
MatrixBase<Derived>::normalized() const
{
return *this / norm();
typedef typename ei_nested<Derived>::type Nested;
typedef typename ei_unref<Nested>::type _Nested;
_Nested n(derived());
return n / n.norm();
}
/** Normalizes the vector, i.e. divides it by its own norm.

View File

@@ -198,6 +198,15 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _MaxRows, _MaxCol
m_storage.resize(rows * cols, rows, cols);
}
inline void resize(int size)
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Matrix)
if(RowsAtCompileTime == 1)
m_storage.resize(size, 1, size);
else
m_storage.resize(size, size, 1);
}
/** Copies the value of the expression \a other into *this.
*
* *this is resized (if possible) to match the dimensions of \a other.

View File

@@ -330,7 +330,7 @@ template<typename Derived> class MatrixBase
Scalar dot(const MatrixBase<OtherDerived>& other) const;
RealScalar norm2() const;
RealScalar norm() const;
const ScalarQuotient1ReturnType normalized() const;
const EvalType normalized() const;
void normalize();
Transpose<Derived> transpose();

View File

@@ -37,13 +37,7 @@
#define EIGEN_UNROLLING_LIMIT 100
#endif
#ifdef EIGEN_DEFAULT_TO_ROW_MAJOR
#define EIGEN_DEFAULT_MATRIX_STORAGE_ORDER RowMajorBit
#else
#define EIGEN_DEFAULT_MATRIX_STORAGE_ORDER 0
#endif
#define EIGEN_DEFAULT_MATRIX_FLAGS EIGEN_DEFAULT_MATRIX_STORAGE_ORDER
#define EIGEN_DEFAULT_MATRIX_FLAGS 0
/** Define a hint size when dealing with large matrices and L2 cache friendlyness
* More precisely, its square value represents the amount of bytes which can be assumed to stay in L2 cache.