compilation fixes

This commit is contained in:
Gael Guennebaud 2009-07-27 13:50:23 +02:00
parent 0590c18555
commit 94cc30180e
8 changed files with 35 additions and 43 deletions

View File

@ -76,9 +76,6 @@ struct ei_selfadjoint_product<Scalar,MatStorageOrder, ColMajor, AAT, UpLo>
Scalar* blockA = ei_aligned_stack_new(Scalar, kc*mc); Scalar* blockA = ei_aligned_stack_new(Scalar, kc*mc);
Scalar* blockB = ei_aligned_stack_new(Scalar, kc*size*Blocking::PacketSize); Scalar* blockB = ei_aligned_stack_new(Scalar, kc*size*Blocking::PacketSize);
// number of columns which can be processed by packet of nr columns
int packet_cols = (size/Blocking::nr)*Blocking::nr;
// note that the actual rhs is the transpose/adjoint of mat // note that the actual rhs is the transpose/adjoint of mat
typedef ei_conj_helper<NumTraits<Scalar>::IsComplex && !AAT, NumTraits<Scalar>::IsComplex && AAT> Conj; typedef ei_conj_helper<NumTraits<Scalar>::IsComplex && !AAT, NumTraits<Scalar>::IsComplex && AAT> Conj;

View File

@ -227,7 +227,7 @@ template<typename MatrixType> class LU
* Example: \include LU_solve.cpp * Example: \include LU_solve.cpp
* Output: \verbinclude LU_solve.out * Output: \verbinclude LU_solve.out
* *
* \sa MatrixBase::solveTriangular(), kernel(), computeKernel(), inverse(), computeInverse() * \sa TriangularView::solve(), kernel(), computeKernel(), inverse(), computeInverse()
*/ */
template<typename OtherDerived, typename ResultType> template<typename OtherDerived, typename ResultType>
bool solve(const MatrixBase<OtherDerived>& b, ResultType *result) const; bool solve(const MatrixBase<OtherDerived>& b, ResultType *result) const;
@ -486,8 +486,7 @@ void LU<MatrixType>::computeKernel(KernelMatrixType *result) const
y(-m_lu.corner(TopRight, m_rank, dimker)); y(-m_lu.corner(TopRight, m_rank, dimker));
m_lu.corner(TopLeft, m_rank, m_rank) m_lu.corner(TopLeft, m_rank, m_rank)
.template marked<UpperTriangular>() .template triangularView<UpperTriangular>().solveInPlace(y);
.solveTriangularInPlace(y);
for(int i = 0; i < m_rank; ++i) result->row(m_q.coeff(i)) = y.row(i); for(int i = 0; i < m_rank; ++i) result->row(m_q.coeff(i)) = y.row(i);
for(int i = m_rank; i < cols; ++i) result->row(m_q.coeff(i)).setZero(); for(int i = m_rank; i < cols; ++i) result->row(m_q.coeff(i)).setZero();
@ -552,9 +551,8 @@ bool LU<MatrixType>::solve(
for(int i = 0; i < rows; ++i) c.row(m_p.coeff(i)) = b.row(i); for(int i = 0; i < rows; ++i) c.row(m_p.coeff(i)) = b.row(i);
// Step 2 // Step 2
m_lu.corner(Eigen::TopLeft,smalldim,smalldim).template marked<UnitLowerTriangular>() m_lu.corner(Eigen::TopLeft,smalldim,smalldim).template triangularView<UnitLowerTriangular>()
.solveTriangularInPlace( .solveInPlace(c.corner(Eigen::TopLeft, smalldim, c.cols()));
c.corner(Eigen::TopLeft, smalldim, c.cols()));
if(rows>cols) if(rows>cols)
{ {
c.corner(Eigen::BottomLeft, rows-cols, c.cols()) c.corner(Eigen::BottomLeft, rows-cols, c.cols())
@ -572,8 +570,8 @@ bool LU<MatrixType>::solve(
return false; return false;
} }
m_lu.corner(TopLeft, m_rank, m_rank) m_lu.corner(TopLeft, m_rank, m_rank)
.template marked<UpperTriangular>() .template triangularView<UpperTriangular>()
.solveTriangularInPlace(c.corner(TopLeft, m_rank, c.cols())); .solveInPlace(c.corner(TopLeft, m_rank, c.cols()));
// Step 4 // Step 4
result->resize(m_lu.cols(), b.cols()); result->resize(m_lu.cols(), b.cols());

View File

@ -127,7 +127,7 @@ template<typename MatrixType> class PartialLU
* Example: \include PartialLU_solve.cpp * Example: \include PartialLU_solve.cpp
* Output: \verbinclude PartialLU_solve.out * Output: \verbinclude PartialLU_solve.out
* *
* \sa MatrixBase::solveTriangular(), inverse(), computeInverse() * \sa TriangularView::solve(), inverse(), computeInverse()
*/ */
template<typename OtherDerived, typename ResultType> template<typename OtherDerived, typename ResultType>
void solve(const MatrixBase<OtherDerived>& b, ResultType *result) const; void solve(const MatrixBase<OtherDerived>& b, ResultType *result) const;
@ -280,12 +280,10 @@ void PartialLU<MatrixType>::solve(
for(int i = 0; i < size; ++i) result->row(m_p.coeff(i)) = b.row(i); for(int i = 0; i < size; ++i) result->row(m_p.coeff(i)) = b.row(i);
// Step 2 // Step 2
m_lu.template marked<UnitLowerTriangular>() m_lu.template triangularView<UnitLowerTriangular>().solveInPlace(*result);
.solveTriangularInPlace(*result);
// Step 3 // Step 3
m_lu.template marked<UpperTriangular>() m_lu.template triangularView<UpperTriangular>().solveInPlace(*result);
.solveTriangularInPlace(*result);
} }
/** \lu_module /** \lu_module

View File

@ -243,7 +243,7 @@ HessenbergDecomposition<MatrixType>::matrixH(void) const
int n = m_matrix.rows(); int n = m_matrix.rows();
MatrixType matH = m_matrix; MatrixType matH = m_matrix;
if (n>2) if (n>2)
matH.corner(BottomLeft,n-2, n-2).template part<LowerTriangular>().setZero(); matH.corner(BottomLeft,n-2, n-2).template triangularView<LowerTriangular>().setZero();
return matH; return matH;
} }

View File

@ -73,7 +73,7 @@ template<typename MatrixType> class HouseholderQR
{ {
ei_assert(m_isInitialized && "HouseholderQR is not initialized."); ei_assert(m_isInitialized && "HouseholderQR is not initialized.");
int cols = m_qr.cols(); int cols = m_qr.cols();
return MatrixRBlockType(m_qr, 0, 0, cols, cols).nestByValue().template part<UpperTriangular>(); return MatrixRBlockType(m_qr, 0, 0, cols, cols).nestByValue().template triangularView<UpperTriangular>();
} }
/** This method finds a solution x to the equation Ax=b, where A is the matrix of which /** This method finds a solution x to the equation Ax=b, where A is the matrix of which
@ -192,8 +192,8 @@ void HouseholderQR<MatrixType>::solve(
const int rank = std::min(result->rows(), result->cols()); const int rank = std::min(result->rows(), result->cols());
m_qr.corner(TopLeft, rank, rank) m_qr.corner(TopLeft, rank, rank)
.template marked<UpperTriangular>() .template triangularView<UpperTriangular>()
.solveTriangularInPlace(result->corner(TopLeft, rank, result->cols())); .solveInPlace(result->corner(TopLeft, rank, result->cols()));
} }
/** \returns the matrix Q */ /** \returns the matrix Q */

View File

@ -173,8 +173,8 @@ Tridiagonalization<MatrixType>::matrixT(void) const
matT.corner(TopRight,n-1, n-1).diagonal() = subDiagonal().template cast<Scalar>().conjugate(); matT.corner(TopRight,n-1, n-1).diagonal() = subDiagonal().template cast<Scalar>().conjugate();
if (n>2) if (n>2)
{ {
matT.corner(TopRight,n-2, n-2).template part<UpperTriangular>().setZero(); matT.corner(TopRight,n-2, n-2).template triangularView<UpperTriangular>().setZero();
matT.corner(BottomLeft,n-2, n-2).template part<LowerTriangular>().setZero(); matT.corner(BottomLeft,n-2, n-2).template triangularView<LowerTriangular>().setZero();
} }
return matT; return matT;
} }

View File

@ -42,8 +42,7 @@ template<typename MatrixType> void syrk(const MatrixType& m)
Rhs2 rhs2 = Rhs2::Random(rows, ei_random<int>(1,320)); Rhs2 rhs2 = Rhs2::Random(rows, ei_random<int>(1,320));
Rhs3 rhs3 = Rhs3::Random(ei_random<int>(1,320), rows); Rhs3 rhs3 = Rhs3::Random(ei_random<int>(1,320), rows);
Scalar s1 = ei_random<Scalar>(), Scalar s1 = ei_random<Scalar>();
s2 = ei_random<Scalar>();
m2.setZero(); m2.setZero();
VERIFY_IS_APPROX((m2.template selfadjointView<LowerTriangular>().rankUpdate(rhs2,s1)._expression()), VERIFY_IS_APPROX((m2.template selfadjointView<LowerTriangular>().rankUpdate(rhs2,s1)._expression()),

View File

@ -24,7 +24,7 @@
#include "main.h" #include "main.h"
template<typename MatrixType> void product_triangular(const MatrixType& m) template<typename MatrixType> void trmv(const MatrixType& m)
{ {
typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Scalar Scalar;
typedef typename NumTraits<Scalar>::Real RealScalar; typedef typename NumTraits<Scalar>::Real RealScalar;
@ -79,14 +79,14 @@ template<typename MatrixType> void product_triangular(const MatrixType& m)
// TODO check with sub-matrices // TODO check with sub-matrices
} }
void test_product_triangular() void test_product_trmv()
{ {
for(int i = 0; i < g_repeat ; i++) { for(int i = 0; i < g_repeat ; i++) {
CALL_SUBTEST( product_triangular(Matrix<float, 1, 1>()) ); CALL_SUBTEST( trmv(Matrix<float, 1, 1>()) );
CALL_SUBTEST( product_triangular(Matrix<float, 2, 2>()) ); CALL_SUBTEST( trmv(Matrix<float, 2, 2>()) );
CALL_SUBTEST( product_triangular(Matrix3d()) ); CALL_SUBTEST( trmv(Matrix3d()) );
CALL_SUBTEST( product_triangular(Matrix<std::complex<float>,23, 23>()) ); CALL_SUBTEST( trmv(Matrix<std::complex<float>,23, 23>()) );
CALL_SUBTEST( product_triangular(MatrixXcd(17,17)) ); CALL_SUBTEST( trmv(MatrixXcd(17,17)) );
CALL_SUBTEST( product_triangular(Matrix<float,Dynamic,Dynamic,RowMajor>(19, 19)) ); CALL_SUBTEST( trmv(Matrix<float,Dynamic,Dynamic,RowMajor>(19, 19)) );
} }
} }