Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef EIGEN_SKYLINEMATRIXBASE_H
00026 #define EIGEN_SKYLINEMATRIXBASE_H
00027
00028 #include "SkylineUtil.h"
00029
00039 template<typename Derived> class SkylineMatrixBase : public EigenBase<Derived> {
00040 public:
00041
00042 typedef typename internal::traits<Derived>::Scalar Scalar;
00043 typedef typename internal::traits<Derived>::StorageKind StorageKind;
00044 typedef typename internal::index<StorageKind>::type Index;
00045
00046 enum {
00047 RowsAtCompileTime = internal::traits<Derived>::RowsAtCompileTime,
00053 ColsAtCompileTime = internal::traits<Derived>::ColsAtCompileTime,
00060 SizeAtCompileTime = (internal::size_at_compile_time<internal::traits<Derived>::RowsAtCompileTime,
00061 internal::traits<Derived>::ColsAtCompileTime>::ret),
00066 MaxRowsAtCompileTime = RowsAtCompileTime,
00067 MaxColsAtCompileTime = ColsAtCompileTime,
00068
00069 MaxSizeAtCompileTime = (internal::size_at_compile_time<MaxRowsAtCompileTime,
00070 MaxColsAtCompileTime>::ret),
00071
00072 IsVectorAtCompileTime = RowsAtCompileTime == 1 || ColsAtCompileTime == 1,
00078 Flags = internal::traits<Derived>::Flags,
00083 CoeffReadCost = internal::traits<Derived>::CoeffReadCost,
00088 IsRowMajor = Flags & RowMajorBit ? 1 : 0
00089 };
00090
00091 #ifndef EIGEN_PARSED_BY_DOXYGEN
00092
00098 typedef typename NumTraits<Scalar>::Real RealScalar;
00099
00101 typedef Matrix<Scalar, EIGEN_SIZE_MAX(RowsAtCompileTime, ColsAtCompileTime),
00102 EIGEN_SIZE_MAX(RowsAtCompileTime, ColsAtCompileTime) > SquareMatrixType;
00103
00104 inline const Derived& derived() const {
00105 return *static_cast<const Derived*> (this);
00106 }
00107
00108 inline Derived& derived() {
00109 return *static_cast<Derived*> (this);
00110 }
00111
00112 inline Derived& const_cast_derived() const {
00113 return *static_cast<Derived*> (const_cast<SkylineMatrixBase*> (this));
00114 }
00115 #endif // not EIGEN_PARSED_BY_DOXYGEN
00116
00118 inline Index rows() const {
00119 return derived().rows();
00120 }
00121
00123 inline Index cols() const {
00124 return derived().cols();
00125 }
00126
00129 inline Index size() const {
00130 return rows() * cols();
00131 }
00132
00135 inline Index nonZeros() const {
00136 return derived().nonZeros();
00137 }
00138
00141 Index outerSize() const {
00142 return (int(Flags) & RowMajorBit) ? this->rows() : this->cols();
00143 }
00144
00147 Index innerSize() const {
00148 return (int(Flags) & RowMajorBit) ? this->cols() : this->rows();
00149 }
00150
00151 bool isRValue() const {
00152 return m_isRValue;
00153 }
00154
00155 Derived& markAsRValue() {
00156 m_isRValue = true;
00157 return derived();
00158 }
00159
00160 SkylineMatrixBase() : m_isRValue(false) {
00161
00162 }
00163
00164 inline Derived & operator=(const Derived& other) {
00165 this->operator=<Derived > (other);
00166 return derived();
00167 }
00168
00169 template<typename OtherDerived>
00170 inline void assignGeneric(const OtherDerived& other) {
00171 derived().resize(other.rows(), other.cols());
00172 for (Index row = 0; row < rows(); row++)
00173 for (Index col = 0; col < cols(); col++) {
00174 if (other.coeff(row, col) != Scalar(0))
00175 derived().insert(row, col) = other.coeff(row, col);
00176 }
00177 derived().finalize();
00178 }
00179
00180 template<typename OtherDerived>
00181 inline Derived & operator=(const SkylineMatrixBase<OtherDerived>& other) {
00182
00183 }
00184
00185 template<typename Lhs, typename Rhs>
00186 inline Derived & operator=(const SkylineProduct<Lhs, Rhs, SkylineTimeSkylineProduct>& product);
00187
00188 friend std::ostream & operator <<(std::ostream & s, const SkylineMatrixBase& m) {
00189 s << m.derived();
00190 return s;
00191 }
00192
00193 template<typename OtherDerived>
00194 const typename SkylineProductReturnType<Derived, OtherDerived>::Type
00195 operator*(const MatrixBase<OtherDerived> &other) const;
00196
00198 template<typename DenseDerived>
00199 void evalTo(MatrixBase<DenseDerived>& dst) const {
00200 dst.setZero();
00201 for (Index i = 0; i < rows(); i++)
00202 for (Index j = 0; j < rows(); j++)
00203 dst(i, j) = derived().coeff(i, j);
00204 }
00205
00206 Matrix<Scalar, RowsAtCompileTime, ColsAtCompileTime> toDense() const {
00207 return derived();
00208 }
00209
00215 EIGEN_STRONG_INLINE const typename internal::eval<Derived, IsSkyline>::type eval() const {
00216 return typename internal::eval<Derived>::type(derived());
00217 }
00218
00219 protected:
00220 bool m_isRValue;
00221 };
00222
00223 #endif // EIGEN_SkylineMatrixBase_H