SparseUtil.h
Go to the documentation of this file.
00001 // This file is part of Eigen, a lightweight C++ template library
00002 // for linear algebra.
00003 //
00004 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
00005 //
00006 // Eigen is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 3 of the License, or (at your option) any later version.
00010 //
00011 // Alternatively, you can redistribute it and/or
00012 // modify it under the terms of the GNU General Public License as
00013 // published by the Free Software Foundation; either version 2 of
00014 // the License, or (at your option) any later version.
00015 //
00016 // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
00017 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00018 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
00019 // GNU General Public License for more details.
00020 //
00021 // You should have received a copy of the GNU Lesser General Public
00022 // License and a copy of the GNU General Public License along with
00023 // Eigen. If not, see <http://www.gnu.org/licenses/>.
00024 
00025 #ifndef EIGEN_SPARSEUTIL_H
00026 #define EIGEN_SPARSEUTIL_H
00027 
00028 #ifdef NDEBUG
00029 #define EIGEN_DBG_SPARSE(X)
00030 #else
00031 #define EIGEN_DBG_SPARSE(X) X
00032 #endif
00033 
00034 #define EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(Derived, Op) \
00035 template<typename OtherDerived> \
00036 EIGEN_STRONG_INLINE Derived& operator Op(const Eigen::SparseMatrixBase<OtherDerived>& other) \
00037 { \
00038   return Base::operator Op(other.derived()); \
00039 } \
00040 EIGEN_STRONG_INLINE Derived& operator Op(const Derived& other) \
00041 { \
00042   return Base::operator Op(other); \
00043 }
00044 
00045 #define EIGEN_SPARSE_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, Op) \
00046 template<typename Other> \
00047 EIGEN_STRONG_INLINE Derived& operator Op(const Other& scalar) \
00048 { \
00049   return Base::operator Op(scalar); \
00050 }
00051 
00052 #define EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATORS(Derived) \
00053 EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(Derived, =) \
00054 EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(Derived, +=) \
00055 EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(Derived, -=) \
00056 EIGEN_SPARSE_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, *=) \
00057 EIGEN_SPARSE_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, /=)
00058 
00059 #define _EIGEN_SPARSE_PUBLIC_INTERFACE(Derived, BaseClass) \
00060   typedef BaseClass Base; \
00061   typedef typename Eigen::internal::traits<Derived>::Scalar Scalar; \
00062   typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; \
00063   typedef typename Eigen::internal::nested<Derived>::type Nested; \
00064   typedef typename Eigen::internal::traits<Derived>::StorageKind StorageKind; \
00065   typedef typename Eigen::internal::traits<Derived>::Index Index; \
00066   enum { RowsAtCompileTime = Eigen::internal::traits<Derived>::RowsAtCompileTime, \
00067         ColsAtCompileTime = Eigen::internal::traits<Derived>::ColsAtCompileTime, \
00068         Flags = Eigen::internal::traits<Derived>::Flags, \
00069         CoeffReadCost = Eigen::internal::traits<Derived>::CoeffReadCost, \
00070         SizeAtCompileTime = Base::SizeAtCompileTime, \
00071         IsVectorAtCompileTime = Base::IsVectorAtCompileTime }; \
00072   using Base::derived; \
00073   using Base::const_cast_derived;
00074 
00075 #define EIGEN_SPARSE_PUBLIC_INTERFACE(Derived) \
00076   _EIGEN_SPARSE_PUBLIC_INTERFACE(Derived, Eigen::SparseMatrixBase<Derived>)
00077 
00078 const int CoherentAccessPattern     = 0x1;
00079 const int InnerRandomAccessPattern  = 0x2 | CoherentAccessPattern;
00080 const int OuterRandomAccessPattern  = 0x4 | CoherentAccessPattern;
00081 const int RandomAccessPattern       = 0x8 | OuterRandomAccessPattern | InnerRandomAccessPattern;
00082 
00083 template<typename Derived> class SparseMatrixBase;
00084 template<typename _Scalar, int _Flags = 0, typename _Index = int>  class SparseMatrix;
00085 template<typename _Scalar, int _Flags = 0, typename _Index = int>  class DynamicSparseMatrix;
00086 template<typename _Scalar, int _Flags = 0, typename _Index = int>  class SparseVector;
00087 template<typename _Scalar, int _Flags = 0, typename _Index = int>  class MappedSparseMatrix;
00088 
00089 template<typename MatrixType, int Size>           class SparseInnerVectorSet;
00090 template<typename MatrixType, int Mode>           class SparseTriangularView;
00091 template<typename MatrixType, unsigned int UpLo>  class SparseSelfAdjointView;
00092 template<typename Lhs, typename Rhs>              class SparseDiagonalProduct;
00093 template<typename MatrixType> class SparseView;
00094 
00095 template<typename Lhs, typename Rhs>        class SparseSparseProduct;
00096 template<typename Lhs, typename Rhs>        class SparseTimeDenseProduct;
00097 template<typename Lhs, typename Rhs>        class DenseTimeSparseProduct;
00098 template<typename Lhs, typename Rhs, bool Transpose> class SparseDenseOuterProduct;
00099 
00100 template<typename Lhs, typename Rhs> struct SparseSparseProductReturnType;
00101 template<typename Lhs, typename Rhs, int InnerSize = internal::traits<Lhs>::ColsAtCompileTime> struct DenseSparseProductReturnType;
00102 template<typename Lhs, typename Rhs, int InnerSize = internal::traits<Lhs>::ColsAtCompileTime> struct SparseDenseProductReturnType;
00103 
00104 namespace internal {
00105 
00106 template<typename T> struct eval<T,Sparse>
00107 {
00108     typedef typename traits<T>::Scalar _Scalar;
00109     enum {
00110           _Flags = traits<T>::Flags
00111     };
00112 
00113   public:
00114     typedef SparseMatrix<_Scalar, _Flags> type;
00115 };
00116 
00117 template<typename T> struct plain_matrix_type<T,Sparse>
00118 {
00119   typedef typename traits<T>::Scalar _Scalar;
00120     enum {
00121           _Flags = traits<T>::Flags
00122     };
00123 
00124   public:
00125     typedef SparseMatrix<_Scalar, _Flags> type;
00126 };
00127 
00128 } // end namespace internal
00129 
00130 #endif // EIGEN_SPARSEUTIL_H


libicr
Author(s): Robert Krug
autogenerated on Mon Jan 6 2014 11:33:39