From 4502afeedf14d32145ffb8b0079c738949fefd48 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Thu, 22 Apr 2010 20:56:33 -0400 Subject: [PATCH] remove disabled/ directory. It's useless. It remains in the hg history anyways. --- disabled/ArrayBase.h | 43 --- disabled/EulerAngles.h | 164 ----------- disabled/Eval.h | 109 ------- disabled/EvalOMP.h | 132 --------- disabled/Eval_MatrixType.cpp | 13 - disabled/HashMatrix.h | 166 ----------- disabled/Householder.h | 33 --- disabled/LinkedVectorMatrix.h | 317 -------------------- disabled/Product.h | 489 ------------------------------- disabled/SkylineMatrix.h | 154 ---------- disabled/SparseSetter.h | 138 --------- disabled/apidox_preprocessing.sh | 44 --- disabled/buildexamplelist.sh | 15 - disabled/class_Eval.cpp | 28 -- disabled/cleanhierarchy.sh | 5 - disabled/ompbench.cxxlist | 7 - disabled/ompbenchmark.cpp | 81 ----- 17 files changed, 1938 deletions(-) delete mode 100644 disabled/ArrayBase.h delete mode 100644 disabled/EulerAngles.h delete mode 100644 disabled/Eval.h delete mode 100644 disabled/EvalOMP.h delete mode 100644 disabled/Eval_MatrixType.cpp delete mode 100644 disabled/HashMatrix.h delete mode 100644 disabled/Householder.h delete mode 100644 disabled/LinkedVectorMatrix.h delete mode 100644 disabled/Product.h delete mode 100644 disabled/SkylineMatrix.h delete mode 100644 disabled/SparseSetter.h delete mode 100755 disabled/apidox_preprocessing.sh delete mode 100755 disabled/buildexamplelist.sh delete mode 100644 disabled/class_Eval.cpp delete mode 100755 disabled/cleanhierarchy.sh delete mode 100644 disabled/ompbench.cxxlist delete mode 100644 disabled/ompbenchmark.cpp diff --git a/disabled/ArrayBase.h b/disabled/ArrayBase.h deleted file mode 100644 index 0d2f3094c..000000000 --- a/disabled/ArrayBase.h +++ /dev/null @@ -1,43 +0,0 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. -// -// Copyright (C) 2006-2008 Benoit Jacob -// -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . - -#ifndef EIGEN_ARRAYBASE_H -#define EIGEN_ARRAYBASE_H - -template class ArrayBase -{ - inline const Derived& derived() const { return *static_cast(this); } - inline Derived& derived() { return *static_cast(this); } - inline Derived& const_cast_derived() const - { return *static_cast(const_cast(this)); } -public: - template - const Product - matrixProduct(const MatrixBase &other) const - { - return Product(derived(), other.derived()); - } -}; - -#endif // EIGEN_ARRAYBASE_H diff --git a/disabled/EulerAngles.h b/disabled/EulerAngles.h deleted file mode 100644 index e535d5859..000000000 --- a/disabled/EulerAngles.h +++ /dev/null @@ -1,164 +0,0 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. -// -// Copyright (C) 2008 Gael Guennebaud -// -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . - -#ifndef EIGEN_EULERANGLES_H -#define EIGEN_EULERANGLES_H - -template -struct ei_eulerangles_assign_impl; - -// enum { -// XYZ, -// XYX, -// -// -// }; - -/** \class EulerAngles - * - * \brief Represents a rotation in a 3 dimensional space as three Euler angles - * - * \param _Scalar the scalar type, i.e., the type of the angles. - * - * \sa class Quaternion, class AngleAxis, class Transform - */ -template -class EulerAngles -{ -public: - enum { Dim = 3 }; - /** the scalar type of the coefficients */ - typedef _Scalar Scalar; - typedef Matrix Matrix3; - typedef Matrix Vector3; - typedef Quaternion QuaternionType; - typedef AngleAxis AngleAxisType; - -protected: - - Vector3 m_angles; - -public: - - EulerAngles() {} - inline EulerAngles(Scalar a0, Scalar a1, Scalar a2) : m_angles(a0, a1, a2) {} - inline EulerAngles(const QuaternionType& q) { *this = q; } - inline EulerAngles(const AngleAxisType& aa) { *this = aa; } - template - inline EulerAngles(const MatrixBase& m) { *this = m; } - - Scalar angle(int i) const { return m_angles.coeff(i); } - Scalar& angle(int i) { return m_angles.coeffRef(i); } - - const Vector3& coeffs() const { return m_angles; } - Vector3& coeffs() { return m_angles; } - - EulerAngles& operator=(const QuaternionType& q); - EulerAngles& operator=(const AngleAxisType& ea); - template - EulerAngles& operator=(const MatrixBase& m); - - template - EulerAngles& fromRotationMatrix(const MatrixBase& m); - Matrix3 toRotationMatrix(void) const; -}; - -/** Set \c *this from a quaternion. - * The axis is normalized. - */ -template -EulerAngles& EulerAngles::operator=(const QuaternionType& q) -{ - Scalar y2 = q.y() * q.y(); - m_angles.coeffRef(0) = std::atan2(2*(q.w()*q.x() + q.y()*q.z()), (1 - 2*(q.x()*q.x() + y2))); - m_angles.coeffRef(1) = std::asin( 2*(q.w()*q.y() - q.z()*q.x())); - m_angles.coeffRef(2) = std::atan2(2*(q.w()*q.z() + q.x()*q.y()), (1 - 2*(y2 + q.z()*q.z()))); - return *this; -} - -/** Set \c *this from Euler angles \a ea. - */ -template -EulerAngles& EulerAngles::operator=(const AngleAxisType& aa) -{ - return *this = QuaternionType(aa); -} - -/** Set \c *this from the expression \a xpr: - * - if \a xpr is a 3x1 vector, then \a xpr is assumed to be a vector of angles - * - if \a xpr is a 3x3 matrix, then \a xpr is assumed to be rotation matrix - * and \a xpr is converted to Euler angles - */ -template -template -EulerAngles& EulerAngles::operator=(const MatrixBase& other) -{ - ei_eulerangles_assign_impl::run(*this,other.derived()); - return *this; -} - -/** Constructs and \returns an equivalent 3x3 rotation matrix. - */ -template -typename EulerAngles::Matrix3 -EulerAngles::toRotationMatrix(void) const -{ - Vector3 c = m_angles.cwise().cos(); - Vector3 s = m_angles.cwise().sin(); - return Matrix3() << - c.y()*c.z(), -c.y()*s.z(), s.y(), - c.z()*s.x()*s.y()+c.x()*s.z(), c.x()*c.z()-s.x()*s.y()*s.z(), -c.y()*s.x(), - -c.x()*c.z()*s.y()+s.x()*s.z(), c.z()*s.x()+c.x()*s.y()*s.z(), c.x()*c.y(); -} - -// set from a rotation matrix -template -struct ei_eulerangles_assign_impl -{ - typedef typename Other::Scalar Scalar; - inline static void run(EulerAngles& ea, const Other& mat) - { - // mat = cy*cz -cy*sz sy - // cz*sx*sy+cx*sz cx*cz-sx*sy*sz -cy*sx - // -cx*cz*sy+sx*sz cz*sx+cx*sy*sz cx*cy - ea.angle(1) = std::asin(mat.coeff(0,2)); - ea.angle(0) = std::atan2(-mat.coeff(1,2),mat.coeff(2,2)); - ea.angle(2) = std::atan2(-mat.coeff(0,1),mat.coeff(0,0)); - } -}; - -// set from a vector of angles -template -struct ei_eulerangles_assign_impl -{ - typedef typename Other::Scalar Scalar; - inline static void run(EulerAngles& ea, const Other& vec) - { - ea.coeffs() = vec; - } -}; - -#endif // EIGEN_EULERANGLES_H diff --git a/disabled/Eval.h b/disabled/Eval.h deleted file mode 100644 index 68a97abc6..000000000 --- a/disabled/Eval.h +++ /dev/null @@ -1,109 +0,0 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. -// -// Copyright (C) 2006-2008 Benoit Jacob -// -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . - -#ifndef EIGEN_EVAL_H -#define EIGEN_EVAL_H - -/** \class Eval - * - * \brief Evaluation of an expression - * - * The template parameter Expression is the type of the expression that we are evaluating. - * - * This class is the return - * type of MatrixBase::eval() and most of the time this is the only way it - * is used. - * - * However, if you want to write a function returning an evaluation of an expression, you - * will need to use this class. - * - * Here is an example illustrating this: - * \include class_Eval.cpp - * Output: \verbinclude class_Eval.out - * - * \sa MatrixBase::eval() - */ -template -struct ei_traits > -{ - typedef typename ExpressionType::Scalar Scalar; - enum { - RowsAtCompileTime = ExpressionType::RowsAtCompileTime, - ColsAtCompileTime = ExpressionType::ColsAtCompileTime, - MaxRowsAtCompileTime = ExpressionType::MaxRowsAtCompileTime, - MaxColsAtCompileTime = ExpressionType::MaxColsAtCompileTime, - Flags = ExpressionType::Flags & ~LazyBit - }; -}; - -template class Eval : ei_no_assignment_operator, - public Matrix< typename ExpressionType::Scalar, - ExpressionType::RowsAtCompileTime, - ExpressionType::ColsAtCompileTime, - ExpressionType::Flags, - ExpressionType::MaxRowsAtCompileTime, - ExpressionType::MaxColsAtCompileTime> -{ - public: - - /** The actual matrix type to evaluate to. This type can be used independently - * of the rest of this class to get the actual matrix type to evaluate and store - * the value of an expression. - * - * Here is an example illustrating this: - * \include Eval_MatrixType.cpp - * Output: \verbinclude Eval_MatrixType.out - */ - typedef Matrix MatrixType; - - _EIGEN_GENERIC_PUBLIC_INTERFACE(Eval, MatrixType) - - explicit Eval(const ExpressionType& expr) : MatrixType(expr) {} -}; - -/** Evaluates *this, which can be any expression, and returns the obtained matrix. - * - * A common use case for this is the following. In an expression-templates library - * like Eigen, the coefficients of an expression are only computed as they are - * accessed, they are not computed when the expression itself is constructed. This is - * usually a good thing, as this "lazy evaluation" improves performance, but can also - * in certain cases lead to wrong results and/or to redundant computations. In such - * cases, one can restore the classical immediate-evaluation behavior by calling eval(). - * - * Example: \include MatrixBase_eval.cpp - * Output: \verbinclude MatrixBase_eval.out - * - * \sa class Eval */ -template -const typename ei_eval_unless_lazy::type MatrixBase::eval() const -{ - return typename ei_eval_unless_lazy::type(derived()); -} - -#endif // EIGEN_EVAL_H diff --git a/disabled/EvalOMP.h b/disabled/EvalOMP.h deleted file mode 100644 index 2a80d37e0..000000000 --- a/disabled/EvalOMP.h +++ /dev/null @@ -1,132 +0,0 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. -// -// Copyright (C) 2008 Gael Guennebaud -// Copyright (C) 2006-2008 Benoit Jacob -// -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . - -#ifndef EIGEN_EVAL_OMP_H -#define EIGEN_EVAL_OMP_H - -/** \class EvalOMP - * - * \brief Parallel evaluation of an expression using OpenMP - * - * The template parameter Expression is the type of the expression that we are evaluating. - * - * This class is the return type of MatrixBase::evalOMP() and most of the time this is the - * only way it is used. - * - * Note that if OpenMP is not enabled, then this class is equivalent to Eval. - * - * \sa MatrixBase::evalOMP(), class Eval, MatrixBase::eval() - */ -template -struct ei_traits > -{ - typedef typename ExpressionType::Scalar Scalar; - enum { - RowsAtCompileTime = ExpressionType::RowsAtCompileTime, - ColsAtCompileTime = ExpressionType::ColsAtCompileTime, - MaxRowsAtCompileTime = ExpressionType::MaxRowsAtCompileTime, - MaxColsAtCompileTime = ExpressionType::MaxColsAtCompileTime, - Flags = ExpressionType::Flags & ~LazyBit - }; -}; - -template class EvalOMP : ei_no_assignment_operator, - public Matrix< typename ExpressionType::Scalar, - ExpressionType::RowsAtCompileTime, - ExpressionType::ColsAtCompileTime, - ExpressionType::Flags, - ExpressionType::MaxRowsAtCompileTime, - ExpressionType::MaxColsAtCompileTime> -{ - public: - - /** The actual matrix type to evaluate to. This type can be used independently - * of the rest of this class to get the actual matrix type to evaluate and store - * the value of an expression. - */ - typedef Matrix MatrixType; - - _EIGEN_GENERIC_PUBLIC_INTERFACE(EvalOMP, MatrixType) - - #ifdef _OPENMP - explicit EvalOMP(const ExpressionType& other) - : MatrixType(other.rows(), other.cols()) - { - #ifdef __INTEL_COMPILER - #pragma omp parallel default(none) shared(other) - #else - #pragma omp parallel default(none) - #endif - { - if (this->cols()>this->rows()) - { - #pragma omp for - for(int j = 0; j < this->cols(); j++) - for(int i = 0; i < this->rows(); i++) - this->coeffRef(i, j) = other.coeff(i, j); - } - else - { - #pragma omp for - for(int i = 0; i < this->rows(); i++) - for(int j = 0; j < this->cols(); j++) - this->coeffRef(i, j) = other.coeff(i, j); - } - } - } - #else - explicit EvalOMP(const ExpressionType& other) : MatrixType(other) {} - #endif -}; - -/** Evaluates *this in a parallel fashion using OpenMP and returns the obtained matrix. - * - * Of course, it only makes sense to call this function for complex expressions, and/or - * large matrices (>32x32), \b and if there is no outer loop which can be parallelized. - * - * It is the responsibility of the user manage the OpenMP parameters, for instance: - * \code - * #include - * // ... - * omp_set_num_threads(omp_get_num_procs()); - * \endcode - * You also need to enable OpenMP on your compiler (e.g., -fopenmp) during both compilation and linking. - * - * Note that if OpenMP is not enabled, then evalOMP() is equivalent to eval(). - * - * \sa class EvalOMP, eval() - */ -template -const EvalOMP MatrixBase::evalOMP() const -{ - return EvalOMP(*static_cast(this)); -} - -#endif // EIGEN_EVAL_OMP_H diff --git a/disabled/Eval_MatrixType.cpp b/disabled/Eval_MatrixType.cpp deleted file mode 100644 index ccff677ac..000000000 --- a/disabled/Eval_MatrixType.cpp +++ /dev/null @@ -1,13 +0,0 @@ -typedef Matrix3i MyMatrixType; -MyMatrixType m = MyMatrixType::random(3, 3); -cout << "Here's the matrix m:" << endl << m << endl; -typedef Eigen::Eval >::MatrixType MyRowType; -// now MyRowType is just the same typedef as RowVector3i -MyRowType r = m.row(0); -cout << "Here's r:" << endl << r << endl; -typedef Eigen::Eval >::MatrixType MyBlockType; -MyBlockType c = m.corner(Eigen::TopRight, 2, 2); -// now MyBlockType is a a matrix type where the number of rows and columns -// are dynamic, but know at compile-time to be <= 2. Therefore no dynamic memory -// allocation occurs. -cout << "Here's c:" << endl << c << endl; diff --git a/disabled/HashMatrix.h b/disabled/HashMatrix.h deleted file mode 100644 index dd8a1ca7c..000000000 --- a/disabled/HashMatrix.h +++ /dev/null @@ -1,166 +0,0 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. -// -// Copyright (C) 2008 Gael Guennebaud -// -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . - -#ifndef EIGEN_HASHMATRIX_H -#define EIGEN_HASHMATRIX_H - -template -struct ei_traits > -{ - typedef _Scalar Scalar; - enum { - RowsAtCompileTime = Dynamic, - ColsAtCompileTime = Dynamic, - MaxRowsAtCompileTime = Dynamic, - MaxColsAtCompileTime = Dynamic, - Flags = SparseBit | _Flags, - CoeffReadCost = NumTraits::ReadCost, - SupportedAccessPatterns = RandomAccessPattern - }; -}; - -// TODO reimplement this class using custom linked lists -template -class HashMatrix - : public SparseMatrixBase > -{ - public: - EIGEN_GENERIC_PUBLIC_INTERFACE(HashMatrix) - class InnerIterator; - protected: - - typedef typename std::map::iterator MapIterator; - typedef typename std::map::const_iterator ConstMapIterator; - - public: - inline int rows() const { return m_innerSize; } - inline int cols() const { return m_data.size(); } - - inline const Scalar& coeff(int row, int col) const - { - const MapIterator it = m_data[col].find(row); - if (it!=m_data[col].end()) - return Scalar(0); - return it->second; - } - - inline Scalar& coeffRef(int row, int col) - { - return m_data[col][row]; - } - - public: - - inline void startFill(int /*reserveSize = 1000 --- currently unused, don't generate a warning*/) {} - - inline Scalar& fill(int row, int col) { return coeffRef(row, col); } - - inline void endFill() {} - - ~HashMatrix() - {} - - inline void shallowCopy(const HashMatrix& other) - { - EIGEN_DBG_SPARSE(std::cout << "HashMatrix:: shallowCopy\n"); - // FIXME implement a true shallow copy !! - resize(other.rows(), other.cols()); - for (int j=0; jouterSize(); ++j) - m_data[j] = other.m_data[j]; - } - - void resize(int _rows, int _cols) - { - if (cols() != _cols) - { - m_data.resize(_cols); - } - m_innerSize = _rows; - } - - inline HashMatrix(int rows, int cols) - : m_innerSize(0) - { - resize(rows, cols); - } - - template - inline HashMatrix(const MatrixBase& other) - : m_innerSize(0) - { - *this = other.derived(); - } - - inline HashMatrix& operator=(const HashMatrix& other) - { - if (other.isRValue()) - { - shallowCopy(other); - } - else - { - resize(other.rows(), other.cols()); - for (int col=0; col - inline HashMatrix& operator=(const MatrixBase& other) - { - return SparseMatrixBase::operator=(other); - } - - protected: - - std::vector > m_data; - int m_innerSize; - -}; - -template -class HashMatrix::InnerIterator -{ - public: - - InnerIterator(const HashMatrix& mat, int col) - : m_matrix(mat), m_it(mat.m_data[col].begin()), m_end(mat.m_data[col].end()) - {} - - InnerIterator& operator++() { m_it++; return *this; } - - Scalar value() { return m_it->second; } - - int index() const { return m_it->first; } - - operator bool() const { return m_it!=m_end; } - - protected: - const HashMatrix& m_matrix; - typename HashMatrix::ConstMapIterator m_it; - typename HashMatrix::ConstMapIterator m_end; -}; - -#endif // EIGEN_HASHMATRIX_H diff --git a/disabled/Householder.h b/disabled/Householder.h deleted file mode 100644 index 9b5f56360..000000000 --- a/disabled/Householder.h +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace Eigen; - -/** From Golub & van Loan Algorithm 5.1.1 page 210 - */ -template -void ei_compute_householder(const InputVector& x, OutputVector *v, typename OutputVector::RealScalar *beta) -{ - EIGEN_STATIC_ASSERT(ei_is_same_type::ret, - YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) - EIGEN_STATIC_ASSERT((InputVector::SizeAtCompileTime == OutputVector::SizeAtCompileTime+1) - || InputVector::SizeAtCompileTime == Dynamic - || OutputVector::SizeAtCompileTime == Dynamic, - YOU_MIXED_VECTORS_OF_DIFFERENT_SIZES) - typedef typename OutputVector::RealScalar RealScalar; - ei_assert(x.size() == v->size()+1); - int n = x.size(); - RealScalar sigma = x.tail(n-1).squaredNorm(); - *v = x.tail(n-1); - // the big assumption in this code is that ei_abs2(x->coeff(0)) is not much smaller than sigma. - if(ei_isMuchSmallerThan(sigma, ei_abs2(x.coeff(0)))) - { - // in this case x is approx colinear to (1,0,....,0) - // fixme, implement this trivial case - } - else - { - RealScalar mu = ei_sqrt(ei_abs2(x.coeff(0)) + sigma); - RealScalar kappa = -sigma/(x.coeff(0)+mu); - *beta = - } -} \ No newline at end of file diff --git a/disabled/LinkedVectorMatrix.h b/disabled/LinkedVectorMatrix.h deleted file mode 100644 index e20d035a3..000000000 --- a/disabled/LinkedVectorMatrix.h +++ /dev/null @@ -1,317 +0,0 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. -// -// Copyright (C) 2008 Gael Guennebaud -// -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . - -#ifndef EIGEN_LINKEDVECTORMATRIX_H -#define EIGEN_LINKEDVECTORMATRIX_H - -template -struct ei_traits > -{ - typedef _Scalar Scalar; - enum { - RowsAtCompileTime = Dynamic, - ColsAtCompileTime = Dynamic, - MaxRowsAtCompileTime = Dynamic, - MaxColsAtCompileTime = Dynamic, - Flags = SparseBit | _Flags, - CoeffReadCost = NumTraits::ReadCost, - SupportedAccessPatterns = InnerCoherentAccessPattern - }; -}; - -template -struct LinkedVectorChunk -{ - LinkedVectorChunk() : next(0), prev(0), size(0) {} - Element data[ChunkSize]; - LinkedVectorChunk* next; - LinkedVectorChunk* prev; - int size; - bool isFull() const { return size==ChunkSize; } -}; - -template -class LinkedVectorMatrix - : public SparseMatrixBase > -{ - public: - EIGEN_GENERIC_PUBLIC_INTERFACE(LinkedVectorMatrix) - class InnerIterator; - protected: - - enum { - RowMajor = Flags&RowMajorBit ? 1 : 0 - }; - - struct ValueIndex - { - ValueIndex() : value(0), index(0) {} - ValueIndex(Scalar v, int i) : value(v), index(i) {} - Scalar value; - int index; - }; - typedef LinkedVectorChunk VectorChunk; - - inline int find(VectorChunk** _el, int id) - { - VectorChunk* el = *_el; - while (el && el->data[el->size-1].indexnext; - *_el = el; - if (el) - { - // binary search - int maxI = el->size-1; - int minI = 0; - int i = el->size/2; - const ValueIndex* data = el->data; - while (data[i].index!=id) - { - if (data[i].index=maxI) - return -1; - } - if (data[i].index==id) - return i; - } - return -1; - } - - public: - inline int rows() const { return RowMajor ? m_data.size() : m_innerSize; } - inline int cols() const { return RowMajor ? m_innerSize : m_data.size(); } - - inline const Scalar& coeff(int row, int col) const - { - const int outer = RowMajor ? row : col; - const int inner = RowMajor ? col : row; - - VectorChunk* el = m_data[outer]; - int id = find(&el, inner); - if (id<0) - return Scalar(0); - return el->data[id].value; - } - - inline Scalar& coeffRef(int row, int col) - { - const int outer = RowMajor ? row : col; - const int inner = RowMajor ? col : row; - - VectorChunk* el = m_data[outer]; - int id = find(&el, inner); - ei_assert(id>=0); -// if (id<0) -// return Scalar(0); - return el->data[id].value; - } - - public: - - inline void startFill(int reserveSize = 1000) - { - clear(); - for (unsigned int i=0; idata[m_ends[outer]->size-1].index < inner); - if (m_ends[outer]->isFull()) - { - - VectorChunk* el = new VectorChunk(); - m_ends[outer]->next = el; - el->prev = m_ends[outer]; - m_ends[outer] = el; - } - } - m_ends[outer]->data[m_ends[outer]->size].index = inner; - return m_ends[outer]->data[m_ends[outer]->size++].value; - } - - inline void endFill() { } - - void printDbg() - { - for (int j=0; jsize; ++i) - std::cout << j << "," << el->data[i].index << " = " << el->data[i].value << "\n"; - el = el->next; - } - } - for (int j=0; jnext; - delete tmp; - } - } - } - - void resize(int rows, int cols) - { - const int outers = RowMajor ? rows : cols; - const int inners = RowMajor ? cols : rows; - - if (this->outerSize() != outers) - { - clear(); - m_data.resize(outers); - m_ends.resize(outers); - for (unsigned int i=0; i - inline LinkedVectorMatrix(const MatrixBase& other) - : m_innerSize(0) - { - *this = other.derived(); - } - - inline void swap(LinkedVectorMatrix& other) - { - EIGEN_DBG_SPARSE(std::cout << "LinkedVectorMatrix:: swap\n"); - resize(other.rows(), other.cols()); - m_data.swap(other.m_data); - m_ends.swap(other.m_ends); - } - - inline LinkedVectorMatrix& operator=(const LinkedVectorMatrix& other) - { - if (other.isRValue()) - { - swap(other.const_cast_derived()); - } - else - { - // TODO implement a specialized deep copy here - return operator=(other); - } - return *this; - } - - template - inline LinkedVectorMatrix& operator=(const MatrixBase& other) - { - return SparseMatrixBase::operator=(other.derived()); - } - - protected: - - // outer vector of inner linked vector chunks - std::vector m_data; - // stores a reference to the last vector chunk for efficient filling - std::vector m_ends; - int m_innerSize; - -}; - - -template -class LinkedVectorMatrix::InnerIterator -{ - public: - - InnerIterator(const LinkedVectorMatrix& mat, int col) - : m_matrix(mat), m_el(mat.m_data[col]), m_it(0) - {} - - InnerIterator& operator++() - { - m_it++; - if (m_it>=m_el->size) - { - m_el = m_el->next; - m_it = 0; - } - return *this; - } - - Scalar value() { return m_el->data[m_it].value; } - - int index() const { return m_el->data[m_it].index; } - - operator bool() const { return m_el && (m_el->next || m_itsize); } - - protected: - const LinkedVectorMatrix& m_matrix; - VectorChunk* m_el; - int m_it; -}; - -#endif // EIGEN_LINKEDVECTORMATRIX_H diff --git a/disabled/Product.h b/disabled/Product.h deleted file mode 100644 index 391cd9e0d..000000000 --- a/disabled/Product.h +++ /dev/null @@ -1,489 +0,0 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. -// -// Copyright (C) 2006-2008 Benoit Jacob -// Copyright (C) 2008 Gael Guennebaud -// -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . - -#ifndef EIGEN_PRODUCT_H -#define EIGEN_PRODUCT_H - -template -struct ei_product_unroller -{ - inline static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, - typename Lhs::Scalar &res) - { - ei_product_unroller::run(row, col, lhs, rhs, res); - res += lhs.coeff(row, Index) * rhs.coeff(Index, col); - } -}; - -template -struct ei_product_unroller<0, Size, Lhs, Rhs> -{ - inline static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, - typename Lhs::Scalar &res) - { - res = lhs.coeff(row, 0) * rhs.coeff(0, col); - } -}; - -template -struct ei_product_unroller -{ - inline static void run(int, int, const Lhs&, const Rhs&, typename Lhs::Scalar&) {} -}; - -// prevent buggy user code from causing an infinite recursion -template -struct ei_product_unroller -{ - inline static void run(int, int, const Lhs&, const Rhs&, typename Lhs::Scalar&) {} -}; - -template -struct ei_product_unroller<0, Dynamic, Lhs, Rhs> -{ - static void run(int, int, const Lhs&, const Rhs&, typename Lhs::Scalar&) {} -}; - -template -struct ei_packet_product_unroller; - -template -struct ei_packet_product_unroller -{ - inline static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res) - { - ei_packet_product_unroller::run(row, col, lhs, rhs, res); - res = ei_pmadd(ei_pset1(lhs.coeff(row, Index)), rhs.template packet(Index, col), res); - } -}; - -template -struct ei_packet_product_unroller -{ - inline static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res) - { - ei_packet_product_unroller::run(row, col, lhs, rhs, res); - res = ei_pmadd(lhs.template packet(row, Index), ei_pset1(rhs.coeff(Index, col)), res); - } -}; - -template -struct ei_packet_product_unroller -{ - inline static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res) - { - res = ei_pmul(ei_pset1(lhs.coeff(row, 0)),rhs.template packet(0, col)); - } -}; - -template -struct ei_packet_product_unroller -{ - inline static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res) - { - res = ei_pmul(lhs.template packet(row, 0), ei_pset1(rhs.coeff(0, col))); - } -}; - -template -struct ei_packet_product_unroller -{ - inline static void run(int, int, const Lhs&, const Rhs&, PacketScalar&) {} -}; - -template -struct ei_packet_product_unroller -{ - inline static void run(int, int, const Lhs&, const Rhs&, PacketScalar&) {} -}; - -template -struct ei_packet_product_unroller -{ - static void run(int, int, const Lhs&, const Rhs&, PacketScalar&) {} -}; - -template struct ProductPacketImpl { - inline static typename Product::PacketScalar execute(const Product& product, int row, int col) - { return product._packetRowMajor(row,col); } -}; - -template struct ProductPacketImpl { - inline static typename Product::PacketScalar execute(const Product& product, int row, int col) - { return product._packetColumnMajor(row,col); } -}; - -/** \class Product - * - * \brief Expression of the product of two matrices - * - * \param Lhs the type of the left-hand side - * \param Rhs the type of the right-hand side - * \param EvalMode internal use only - * - * This class represents an expression of the product of two matrices. - * It is the return type of the operator* between matrices, and most of the time - * this is the only way it is used. - * - * \sa class Sum, class Difference - */ -template struct ei_product_eval_mode -{ - enum{ value = Lhs::MaxRowsAtCompileTime >= EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD - && Rhs::MaxColsAtCompileTime >= EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD - && (!( (Lhs::Flags&RowMajorBit) && ((Rhs::Flags&RowMajorBit) ^ RowMajorBit))) - ? CacheFriendlyProduct : NormalProduct }; -}; - -template -struct ei_traits > -{ - typedef typename Lhs::Scalar Scalar; - typedef typename ei_nested::type LhsNested; - typedef typename ei_nested::type RhsNested; - typedef typename ei_unref::type _LhsNested; - typedef typename ei_unref::type _RhsNested; - enum { - LhsCoeffReadCost = _LhsNested::CoeffReadCost, - RhsCoeffReadCost = _RhsNested::CoeffReadCost, - LhsFlags = _LhsNested::Flags, - RhsFlags = _RhsNested::Flags, - RowsAtCompileTime = Lhs::RowsAtCompileTime, - ColsAtCompileTime = Rhs::ColsAtCompileTime, - MaxRowsAtCompileTime = Lhs::MaxRowsAtCompileTime, - MaxColsAtCompileTime = Rhs::MaxColsAtCompileTime, - _RhsPacketAccess = (RhsFlags & RowMajorBit) && (RhsFlags & PacketAccessBit) && (ColsAtCompileTime % ei_packet_traits::size == 0), - _LhsPacketAccess = (!(LhsFlags & RowMajorBit)) && (LhsFlags & PacketAccessBit) && (RowsAtCompileTime % ei_packet_traits::size == 0), - _PacketAccess = (_LhsPacketAccess || _RhsPacketAccess) ? 1 : 0, - _RowMajor = (RhsFlags & RowMajorBit) - && (EvalMode==(int)CacheFriendlyProduct ? (int)LhsFlags & RowMajorBit : (!_LhsPacketAccess)), - _LostBits = HereditaryBits & ~( - (_RowMajor ? 0 : RowMajorBit) - | ((RowsAtCompileTime == Dynamic || ColsAtCompileTime == Dynamic) ? 0 : LargeBit)), - Flags = ((unsigned int)(LhsFlags | RhsFlags) & _LostBits) - | EvalBeforeAssigningBit - | EvalBeforeNestingBit - | (_PacketAccess ? PacketAccessBit : 0), - CoeffReadCost - = Lhs::ColsAtCompileTime == Dynamic - ? Dynamic - : Lhs::ColsAtCompileTime - * (NumTraits::MulCost + LhsCoeffReadCost + RhsCoeffReadCost) - + (Lhs::ColsAtCompileTime - 1) * NumTraits::AddCost - }; -}; - -template class Product : ei_no_assignment_operator, - public MatrixBase > -{ - public: - - EIGEN_GENERIC_PUBLIC_INTERFACE(Product) - friend class ProductPacketImpl; - typedef typename ei_traits::LhsNested LhsNested; - typedef typename ei_traits::RhsNested RhsNested; - typedef typename ei_traits::_LhsNested _LhsNested; - typedef typename ei_traits::_RhsNested _RhsNested; - - inline Product(const Lhs& lhs, const Rhs& rhs) - : m_lhs(lhs), m_rhs(rhs) - { - ei_assert(lhs.cols() == rhs.rows()); - } - - /** \internal */ - template - void _cacheOptimalEval(DestDerived& res, ei_meta_false) const; - #ifdef EIGEN_VECTORIZE - template - void _cacheOptimalEval(DestDerived& res, ei_meta_true) const; - #endif - - private: - - inline int _rows() const { return m_lhs.rows(); } - inline int _cols() const { return m_rhs.cols(); } - - const Scalar _coeff(int row, int col) const - { - Scalar res; - const bool unroll = CoeffReadCost <= EIGEN_UNROLLING_LIMIT; - if(unroll) - { - ei_product_unroller - ::run(row, col, m_lhs, m_rhs, res); - } - else - { - res = m_lhs.coeff(row, 0) * m_rhs.coeff(0, col); - for(int i = 1; i < m_lhs.cols(); i++) - res += m_lhs.coeff(row, i) * m_rhs.coeff(i, col); - } - return res; - } - - template - const PacketScalar _packet(int row, int col) const - { - if(Lhs::ColsAtCompileTime <= EIGEN_UNROLLING_LIMIT) - { - PacketScalar res; - ei_packet_product_unroller - ::run(row, col, m_lhs, m_rhs, res); - return res; - } - else - return ProductPacketImpl::execute(*this, row, col); - } - - const PacketScalar _packetRowMajor(int row, int col) const - { - PacketScalar res; - res = ei_pmul(ei_pset1(m_lhs.coeff(row, 0)),m_rhs.template packet(0, col)); - for(int i = 1; i < m_lhs.cols(); i++) - res = ei_pmadd(ei_pset1(m_lhs.coeff(row, i)), m_rhs.template packet(i, col), res); - return res; - } - - const PacketScalar _packetColumnMajor(int row, int col) const - { - PacketScalar res; - res = ei_pmul(m_lhs.template packet(row, 0), ei_pset1(m_rhs.coeff(0, col))); - for(int i = 1; i < m_lhs.cols(); i++) - res = ei_pmadd(m_lhs.template packet(row, i), ei_pset1(m_rhs.coeff(i, col)), res); - return res; -// const PacketScalar tmp[4]; -// ei_punpack(m_rhs.packet(0,col), tmp); -// -// return -// ei_pmadd(m_lhs.packet(row, 0), tmp[0], -// ei_pmadd(m_lhs.packet(row, 1), tmp[1], -// ei_pmadd(m_lhs.packet(row, 2), tmp[2] -// ei_pmul(m_lhs.packet(row, 3), tmp[3])))); - } - - - protected: - const LhsNested m_lhs; - const RhsNested m_rhs; -}; - -/** \returns the matrix product of \c *this and \a other. - * - * \note This function causes an immediate evaluation. If you want to perform a matrix product - * without immediate evaluation, call .lazy() on one of the matrices before taking the product. - * - * \sa lazy(), operator*=(const MatrixBase&) - */ -template -template -inline const Product -MatrixBase::operator*(const MatrixBase &other) const -{ - return Product(derived(), other.derived()); -} - -/** replaces \c *this by \c *this * \a other. - * - * \returns a reference to \c *this - */ -template -template -inline Derived & -MatrixBase::operator*=(const MatrixBase &other) -{ - return *this = *this * other; -} - -template -template -inline Derived& MatrixBase::lazyAssign(const Product& product) -{ - product.template _cacheOptimalEval(derived(), - #ifdef EIGEN_VECTORIZE - typename ei_meta_if::ret() - #else - ei_meta_false() - #endif - ); - return derived(); -} - -template -template -void Product::_cacheOptimalEval(DestDerived& res, ei_meta_false) const -{ - res.setZero(); - const int cols4 = m_lhs.cols() & 0xfffffffC; - if (Lhs::Flags&RowMajorBit) - { -// std::cout << "opt rhs\n"; - int j=0; - for(; jrows(); ++k) - { - const Scalar tmp0 = m_lhs.coeff(k,j ); - const Scalar tmp1 = m_lhs.coeff(k,j+1); - const Scalar tmp2 = m_lhs.coeff(k,j+2); - const Scalar tmp3 = m_lhs.coeff(k,j+3); - for (int i=0; icols(); ++i) - res.coeffRef(k,i) += tmp0 * m_rhs.coeff(j+0,i) + tmp1 * m_rhs.coeff(j+1,i) - + tmp2 * m_rhs.coeff(j+2,i) + tmp3 * m_rhs.coeff(j+3,i); - } - } - for(; jrows(); ++k) - { - const Scalar tmp = m_rhs.coeff(k,j); - for (int i=0; icols(); ++i) - res.coeffRef(k,i) += tmp * m_lhs.coeff(j,i); - } - } - } - else - { -// std::cout << "opt lhs\n"; - int j = 0; - for(; jcols(); ++k) - { - const Scalar tmp0 = m_rhs.coeff(j ,k); - const Scalar tmp1 = m_rhs.coeff(j+1,k); - const Scalar tmp2 = m_rhs.coeff(j+2,k); - const Scalar tmp3 = m_rhs.coeff(j+3,k); - for (int i=0; irows(); ++i) - res.coeffRef(i,k) += tmp0 * m_lhs.coeff(i,j+0) + tmp1 * m_lhs.coeff(i,j+1) - + tmp2 * m_lhs.coeff(i,j+2) + tmp3 * m_lhs.coeff(i,j+3); - } - } - for(; jcols(); ++k) - { - const Scalar tmp = m_rhs.coeff(j,k); - for (int i=0; irows(); ++i) - res.coeffRef(i,k) += tmp * m_lhs.coeff(i,j); - } - } - } -} - -#ifdef EIGEN_VECTORIZE -template -template -void Product::_cacheOptimalEval(DestDerived& res, ei_meta_true) const -{ - - if (((Lhs::Flags&RowMajorBit) && (_cols() % ei_packet_traits::size != 0)) - || (_rows() % ei_packet_traits::size != 0)) - { - return _cacheOptimalEval(res, ei_meta_false()); - } - - res.setZero(); - const int cols4 = m_lhs.cols() & 0xfffffffC; - if (Lhs::Flags&RowMajorBit) - { -// std::cout << "packet rhs\n"; - int j=0; - for(; jrows(); k++) - { - const typename ei_packet_traits::type tmp0 = ei_pset1(m_lhs.coeff(k,j+0)); - const typename ei_packet_traits::type tmp1 = ei_pset1(m_lhs.coeff(k,j+1)); - const typename ei_packet_traits::type tmp2 = ei_pset1(m_lhs.coeff(k,j+2)); - const typename ei_packet_traits::type tmp3 = ei_pset1(m_lhs.coeff(k,j+3)); - for (int i=0; icols(); i+=ei_packet_traits::size) - { - res.template writePacket(k,i, - ei_pmadd(tmp0, m_rhs.template packet(j+0,i), - ei_pmadd(tmp1, m_rhs.template packet(j+1,i), - ei_pmadd(tmp2, m_rhs.template packet(j+2,i), - ei_pmadd(tmp3, m_rhs.template packet(j+3,i), - res.template packet(k,i))))) - ); - } - } - } - for(; jrows(); k++) - { - const typename ei_packet_traits::type tmp = ei_pset1(m_lhs.coeff(k,j)); - for (int i=0; icols(); i+=ei_packet_traits::size) - res.template writePacket(k,i, - ei_pmadd(tmp, m_rhs.template packet(j,i), res.template packet(k,i))); - } - } - } - else - { -// std::cout << "packet lhs\n"; - int k=0; - for(; kcols(); j+=1) - { - const typename ei_packet_traits::type tmp0 = ei_pset1(m_rhs.coeff(k+0,j)); - const typename ei_packet_traits::type tmp1 = ei_pset1(m_rhs.coeff(k+1,j)); - const typename ei_packet_traits::type tmp2 = ei_pset1(m_rhs.coeff(k+2,j)); - const typename ei_packet_traits::type tmp3 = ei_pset1(m_rhs.coeff(k+3,j)); - - for (int i=0; irows(); i+=ei_packet_traits::size) - { - res.template writePacket(i,j, - ei_pmadd(tmp0, m_lhs.template packet(i,k), - ei_pmadd(tmp1, m_lhs.template packet(i,k+1), - ei_pmadd(tmp2, m_lhs.template packet(i,k+2), - ei_pmadd(tmp3, m_lhs.template packet(i,k+3), - res.template packet(i,j))))) - ); - } - } - } - for(; kcols(); j++) - { - const typename ei_packet_traits::type tmp = ei_pset1(m_rhs.coeff(k,j)); - for (int i=0; irows(); i+=ei_packet_traits::size) - res.template writePacket(k,j, - ei_pmadd(tmp, m_lhs.template packet(i,k), res.template packet(i,j))); - } - } - } -} -#endif // EIGEN_VECTORIZE - -#endif // EIGEN_PRODUCT_H diff --git a/disabled/SkylineMatrix.h b/disabled/SkylineMatrix.h deleted file mode 100644 index 640f676bd..000000000 --- a/disabled/SkylineMatrix.h +++ /dev/null @@ -1,154 +0,0 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. -// -// Copyright (C) 2009 Gael Guennebaud -// -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . - -#ifndef EIGEN_BANDMATRIX_H -#define EIGEN_BANDMATRIX_H - -/** \nonstableyet - * \class BandMatrix - * - * \brief - * - * \param - * - * \sa - */ -template -struct ei_traits > -{ - typedef _Scalar Scalar; - enum { - CoeffReadCost = NumTraits::ReadCost, - RowsAtCompileTime = Size, - ColsAtCompileTime = Size, - MaxRowsAtCompileTime = Size, - MaxColsAtCompileTime = Size, - Flags = 0 - }; -}; - -template -class BandMatrix : public MultiplierBase > -{ - public: - - enum { - Flags = ei_traits::Flags, - CoeffReadCost = ei_traits::CoeffReadCost, - RowsAtCompileTime = ei_traits::RowsAtCompileTime, - ColsAtCompileTime = ei_traits::ColsAtCompileTime, - MaxRowsAtCompileTime = ei_traits::MaxRowsAtCompileTime, - MaxColsAtCompileTime = ei_traits::MaxColsAtCompileTime - }; - typedef typename ei_traits::Scalar Scalar; - typedef Matrix PlainObject; - - protected: - enum { - DataSizeAtCompileTime = ((Size!=Dynamic) && (Supers!=Dynamic) && (Subs!=Dynamic)) - ? Size*(Supers+Subs+1) - (Supers*Supers+Subs*Subs)/2 - : Dynamic - }; - typedef Matrix DataType; - - public: - -// inline BandMatrix() { } - - inline BandMatrix(int size=Size, int supers=Supers, int subs=Subs) - : m_data(size*(supers+subs+1) - (supers*supers+subs*subs)/2), - m_size(size), m_supers(supers), m_subs(subs) - { } - - inline int rows() const { return m_size.value(); } - inline int cols() const { return m_size.value(); } - - inline int supers() const { return m_supers.value(); } - inline int subs() const { return m_subs.value(); } - - inline VectorBlock diagonal() - { return VectorBlock(m_data,0,m_size.value()); } - - inline const VectorBlock diagonal() const - { return VectorBlock(m_data,0,m_size.value()); } - - template - VectorBlock - diagonal() - { - return VectorBlock - (m_data,Index<0 ? subDiagIndex(-Index) : superDiagIndex(Index), m_size.value()-ei_abs(Index)); - } - - template - const VectorBlock - diagonal() const - { - return VectorBlock - (m_data,Index<0 ? subDiagIndex(-Index) : superDiagIndex(Index), m_size.value()-ei_abs(Index)); - } - - inline VectorBlock diagonal(int index) - { - ei_assert((index<0 && -index<=subs()) || (index>=0 && index<=supers())); - return VectorBlock(m_data, - index<0 ? subDiagIndex(-index) : superDiagIndex(index), m_size.value()-ei_abs(index)); - } - const VectorBlock diagonal(int index) const - { - ei_assert((index<0 && -index<=subs()) || (index>=0 && index<=supers())); - return VectorBlock(m_data, - index<0 ? subDiagIndex(-index) : superDiagIndex(index), m_size.value()-ei_abs(index)); - } - -// inline VectorBlock subDiagonal() -// { return VectorBlock(m_data,0,m_size.value()); } - - PlainObject toDense() const - { - PlainObject res(rows(),cols()); - res.setZero(); - res.diagonal() = diagonal(); - for (int i=1; i<=supers();++i) - res.diagonal(i) = diagonal(i); - for (int i=1; i<=subs();++i) - res.diagonal(-i) = diagonal(-i); - return res; - } - - protected: - - inline int subDiagIndex(int i) const - { return m_size.value()*(m_supers.value()+i)-(ei_abs2(i-1) + ei_abs2(m_supers.value()))/2; } - - inline int superDiagIndex(int i) const - { return m_size.value()*i-ei_abs2(i-1)/2; } - - DataType m_data; - ei_int_if_dynamic m_size; - ei_int_if_dynamic m_supers; - ei_int_if_dynamic m_subs; -}; - -#endif // EIGEN_BANDMATRIX_H diff --git a/disabled/SparseSetter.h b/disabled/SparseSetter.h deleted file mode 100644 index 7a3a17b89..000000000 --- a/disabled/SparseSetter.h +++ /dev/null @@ -1,138 +0,0 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. -// -// Copyright (C) 2008 Gael Guennebaud -// -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . - -#ifndef EIGEN_SPARSESETTER_H -#define EIGEN_SPARSESETTER_H - -template::ret> -struct ei_sparse_setter_selector; - -/** \class SparseSetter - * - * Goal: provides a unified API to fill/update a dense or sparse matrix. - * - * Usage: - * \code - * { - * SparseSetter w(m); - * for (...) w->coeffRef(rand(),rand()) = rand(); - * } - * \endcode - * - * In the above example we want to fill a matrix m (could be a SparseMatrix or whatever other matrix type) - * in a random fashion (whence the RandomAccessPattern). Internally, if \a MatrixType supports random writes - * then \c w behaves as a pointer to m, and m is filled directly. Otherwise, a temporary matrix supporting - * random writes is created and \c w behaves as a pointer to this temporary object. When the object \c w - * is deleted (at the end of the block), then the temporary object is assigned to the matrix m. - * - * So far we can distinghished 4 types of access pattern: - * - FullyCoherentAccessPattern (if col major, i+j*rows must increase) - * - InnerCoherentAccessPattern (if col major, i must increase for each column j) - * - OuterCoherentAccessPattern (if col major, the column j is set in a random order, but j must increase) - * - RandomAccessPattern - * - * See the wiki for more details. - * - * The template class ei_support_access_pattern is used to determine the type of the temporary object (which - * can be a reference to \a MatrixType if \a MatrixType support \a AccessPattern) - * - * Currently only the RandomAccessPattern seems to work as expected. - * - * \todo define the API for each kind of access pattern - * \todo allows both update and set modes (set start a new matrix) - * \todo implement the OuterCoherentAccessPattern - * - */ -template::type> -class SparseSetter -{ - typedef typename ei_unref::type _WrapperType; - public: - - inline SparseSetter(MatrixType& matrix) : m_wrapper(matrix), mp_matrix(&matrix) {} - - ~SparseSetter() - { *mp_matrix = m_wrapper; } - - inline _WrapperType* operator->() { return &m_wrapper; } - - inline _WrapperType& operator*() { return m_wrapper; } - - protected: - - WrapperType m_wrapper; - MatrixType* mp_matrix; -}; - -template -struct ei_sparse_setter_selector -{ - typedef MatrixType& type; -}; - -// forward each derived of SparseMatrixBase to the generic SparseMatrixBase specializations -template -struct ei_sparse_setter_selector, AccessPattern, AccessPatternNotSupported> -: public ei_sparse_setter_selector >,AccessPattern, AccessPatternNotSupported> -{}; - -template -struct ei_sparse_setter_selector, AccessPattern, AccessPatternNotSupported> -: public ei_sparse_setter_selector >,AccessPattern, AccessPatternNotSupported> -{}; - -template -struct ei_sparse_setter_selector, AccessPattern, AccessPatternNotSupported> -: public ei_sparse_setter_selector >,AccessPattern, AccessPatternNotSupported> -{}; - -// generic SparseMatrixBase specializations -template -struct ei_sparse_setter_selector, RandomAccessPattern, AccessPatternNotSupported> -{ - typedef HashMatrix type; -}; - -template -struct ei_sparse_setter_selector, OuterCoherentAccessPattern, AccessPatternNotSupported> -{ - typedef HashMatrix type; -}; - -template -struct ei_sparse_setter_selector, InnerCoherentAccessPattern, AccessPatternNotSupported> -{ - typedef LinkedVectorMatrix type; -}; - -template -struct ei_sparse_setter_selector, FullyCoherentAccessPattern, AccessPatternNotSupported> -{ - typedef SparseMatrix type; -}; - -#endif // EIGEN_SPARSESETTER_H diff --git a/disabled/apidox_preprocessing.sh b/disabled/apidox_preprocessing.sh deleted file mode 100755 index a611465cb..000000000 --- a/disabled/apidox_preprocessing.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash - -CXX=`which g++` -SRC=$1 -mkdir -p eigen2/out - -if expr match $SRC ".*\/examples\/.*" > /dev/null ; then - -# DST=`echo $SRC | sed 's/examples/out/' | sed 's/cpp$/out/'` - DST=`echo $SRC | sed 's/.*\/examples/eigen2\/out/' | sed 's/cpp$/out/'` - INC=`echo $SRC | sed 's/\/doc\/examples\/.*/\//'` - - if ! test -e $DST || test $SRC -nt $DST ; then - $CXX $SRC -I. -I$INC -o eitmp_example && ./eitmp_example > $DST - rm eitmp_example - fi - -elif expr match $SRC ".*\/snippets\/.*" > /dev/null ; then - -# DST=`echo $SRC | sed 's/snippets/out/' | sed 's/cpp$/out/'` - DST=`echo $SRC | sed 's/.*\/snippets/eigen2\/out/' | sed 's/cpp$/out/'` - INC=`echo $SRC | sed 's/\/doc\/snippets\/.*/\//'` - - if ! test -e $DST || test $SRC -nt $DST ; then - echo "#include " > .ei_in.cpp - echo "#include " >> .ei_in.cpp - echo "#include " >> .ei_in.cpp - echo "#include " >> .ei_in.cpp - echo "#include " >> .ei_in.cpp - echo "using namespace Eigen; using namespace std;" >> .ei_in.cpp - echo "int main(int, char**){cout.precision(3);" >> .ei_in.cpp - cat $SRC >> .ei_in.cpp - echo "return 0;}" >> .ei_in.cpp - echo " " >> .ei_in.cpp - - $CXX .ei_in.cpp -I. -I$INC -o eitmp_example && ./eitmp_example > $DST - rm eitmp_example - rm .ei_in.cpp - fi - -fi - -cat $SRC -exit 0 diff --git a/disabled/buildexamplelist.sh b/disabled/buildexamplelist.sh deleted file mode 100755 index 7d47ae39d..000000000 --- a/disabled/buildexamplelist.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -echo "namespace Eigen {" -echo "/** \page ExampleList" -echo "

Selected list of examples

" - -grep \\addexample $1/Eigen/src/*/*.h -R | cut -d \\ -f 2- | \ -while read example; -do -anchor=`echo "$example" | cut -d " " -f 2` -text=`echo "$example" | cut -d " " -f 4-` -echo "\\\li \\\ref $anchor \"$text\"" -done -echo "*/" -echo "}" \ No newline at end of file diff --git a/disabled/class_Eval.cpp b/disabled/class_Eval.cpp deleted file mode 100644 index ceb76897c..000000000 --- a/disabled/class_Eval.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include -using namespace Eigen; -using namespace std; - -template -const Eigen::Eval > -evaluatedTranspose(const MatrixBase& m) -{ - return m.transpose().eval(); -} - -int main(int, char**) -{ - Matrix2f M = Matrix2f::random(); - Matrix2f m; - m = M; - cout << "Here is the matrix m:" << endl << m << endl; - cout << "Now we want to replace m by its own transpose." << endl; - cout << "If we do m = m.transpose(), then m becomes:" << endl; - m = m.transpose(); - cout << m << endl << "which is wrong!" << endl; - cout << "Now let us instead do m = evaluatedTranspose(m). Then m becomes" << endl; - m = M; - m = evaluatedTranspose(m); - cout << m << endl << "which is right." << endl; - - return 0; -} diff --git a/disabled/cleanhierarchy.sh b/disabled/cleanhierarchy.sh deleted file mode 100755 index fe44891b9..000000000 --- a/disabled/cleanhierarchy.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -sed -i 's/^.li.*MatrixBase\<.*gt.*a.$/ /g' $1 -sed -i 's/^.li.*MapBase\<.*gt.*a.$/ /g' $1 -sed -i 's/^.li.*RotationBase\<.*gt.*a.$/ /g' $1 diff --git a/disabled/ompbench.cxxlist b/disabled/ompbench.cxxlist deleted file mode 100644 index fc6681d33..000000000 --- a/disabled/ompbench.cxxlist +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -CLIST[((g++))]="g++-4.2 -O3 -DNDEBUG -finline-limit=10000 -fopenmp" - -# CLIST[((g++))]="g++-4.3 -O3 -DNDEBUG -finline-limit=10000 -fopenmp" - -CLIST[((g++))]="icpc -fast -DNDEBUG -fno-exceptions -no-inline-max-size -openmp" \ No newline at end of file diff --git a/disabled/ompbenchmark.cpp b/disabled/ompbenchmark.cpp deleted file mode 100644 index 2e996f2e3..000000000 --- a/disabled/ompbenchmark.cpp +++ /dev/null @@ -1,81 +0,0 @@ -// g++ -O3 -DNDEBUG -I.. -fopenmp benchOpenMP.cpp -o benchOpenMP && ./benchOpenMP 2> /dev/null -// icpc -fast -fno-exceptions -DNDEBUG -I.. -openmp benchOpenMP.cpp -o benchOpenMP && ./benchOpenMP 2> /dev/null - -#include -#include "BenchUtil.h" -#include "basicbenchmark.h" - -// #include -// #include "BenchTimer.h" -// -// using namespace std; -// using namespace Eigen; -// -// enum {LazyEval, EarlyEval, OmpEval}; -// -// template -// double benchSingleProc(const MatrixType& mat, int iterations, int tries) __attribute__((noinline)); -// -// template -// double benchBasic(const MatrixType& mat, int iterations, int tries) -// { -// const int rows = mat.rows(); -// const int cols = mat.cols(); -// -// Eigen::BenchTimer timer; -// for(uint t=0; t(Matrix4d(), 10000, 10) << "s " - << benchBasic(Matrix4d(), 10000, 10) << "s \n"; - - #define BENCH_MATRIX(TYPE, SIZE, ITERATIONS, TRIES) {\ - double single = benchBasic(Matrix(SIZE,SIZE), ITERATIONS, TRIES); \ - double omp = benchBasic (Matrix(SIZE,SIZE), ITERATIONS, TRIES); \ - std::cout << #TYPE << ", " << #SIZE << "x" << #SIZE << ": " << single << "s " << omp << "s " \ - << " => x" << single/omp << " (" << omp_get_num_procs() << ")" << std::endl; \ - } - - BENCH_MATRIX(double, 32, 1000, 10); - BENCH_MATRIX(double, 128, 10, 10); - BENCH_MATRIX(double, 512, 1, 6); - BENCH_MATRIX(double, 1024, 1, 4); - - return 0; -} -