SkylineMatrixBase.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2008-2009 Guillaume Saupin <guillaume.saupin@cea.fr>
5 //
6 // This Source Code Form is subject to the terms of the Mozilla
7 // Public License v. 2.0. If a copy of the MPL was not distributed
8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 
10 #ifndef EIGEN_SKYLINEMATRIXBASE_H
11 #define EIGEN_SKYLINEMATRIXBASE_H
12 
13 #include "SkylineUtil.h"
14 
15 namespace Eigen {
16 
26 template<typename Derived> class SkylineMatrixBase : public EigenBase<Derived> {
27 public:
28 
32 
33  enum {
55 
58 
76  };
77 
78 #ifndef EIGEN_PARSED_BY_DOXYGEN
79 
86 
90 
91  inline const Derived& derived() const {
92  return *static_cast<const Derived*> (this);
93  }
94 
95  inline Derived& derived() {
96  return *static_cast<Derived*> (this);
97  }
98 
99  inline Derived& const_cast_derived() const {
100  return *static_cast<Derived*> (const_cast<SkylineMatrixBase*> (this));
101  }
102 #endif // not EIGEN_PARSED_BY_DOXYGEN
103 
106  return derived().rows();
107  }
108 
111  return derived().cols();
112  }
113 
117  return rows() * cols();
118  }
119 
122  inline Index nonZeros() const {
123  return derived().nonZeros();
124  }
125 
128  Index outerSize() const {
129  return (int(Flags) & RowMajorBit) ? this->rows() : this->cols();
130  }
131 
134  Index innerSize() const {
135  return (int(Flags) & RowMajorBit) ? this->cols() : this->rows();
136  }
137 
138  bool isRValue() const {
139  return m_isRValue;
140  }
141 
142  Derived& markAsRValue() {
143  m_isRValue = true;
144  return derived();
145  }
146 
148  /* TODO check flags */
149  }
150 
151  inline Derived & operator=(const Derived& other) {
152  this->operator=<Derived > (other);
153  return derived();
154  }
155 
156  template<typename OtherDerived>
157  inline void assignGeneric(const OtherDerived& other) {
158  derived().resize(other.rows(), other.cols());
159  for (Index row = 0; row < rows(); row++)
160  for (Index col = 0; col < cols(); col++) {
161  if (other.coeff(row, col) != Scalar(0))
162  derived().insert(row, col) = other.coeff(row, col);
163  }
164  derived().finalize();
165  }
166 
167  template<typename OtherDerived>
169  //TODO
170  }
171 
172  template<typename Lhs, typename Rhs>
174 
175  friend std::ostream & operator <<(std::ostream & s, const SkylineMatrixBase& m) {
176  s << m.derived();
177  return s;
178  }
179 
180  template<typename OtherDerived>
183 
185  template<typename DenseDerived>
186  void evalTo(MatrixBase<DenseDerived>& dst) const {
187  dst.setZero();
188  for (Index i = 0; i < rows(); i++)
189  for (Index j = 0; j < rows(); j++)
190  dst(i, j) = derived().coeff(i, j);
191  }
192 
194  return derived();
195  }
196 
203  return typename internal::eval<Derived>::type(derived());
204  }
205 
206 protected:
208 };
209 
210 } // end namespace Eigen
211 
212 #endif // EIGEN_SKYLINEMATRIXBASE_H
Eigen
Namespace containing all symbols from the Eigen library.
Definition: jet.h:637
Eigen::DenseBase::setZero
EIGEN_DEVICE_FUNC Derived & setZero()
Definition: CwiseNullaryOp.h:546
Eigen::SkylineMatrixBase::operator*
const SkylineProductReturnType< Derived, OtherDerived >::Type operator*(const MatrixBase< OtherDerived > &other) const
col
m col(1)
Eigen::SkylineMatrixBase::RealScalar
NumTraits< Scalar >::Real RealScalar
Definition: SkylineMatrixBase.h:85
gtsam.examples.DogLegOptimizerExample.type
type
Definition: DogLegOptimizerExample.py:111
s
RealScalar s
Definition: level1_cplx_impl.h:126
Eigen::EigenBase< SkylineMatrix< _Scalar, _Options > >::Index
Eigen::Index Index
The interface type of indices.
Definition: EigenBase.h:39
Eigen::EigenBase
Definition: EigenBase.h:29
Eigen::SkylineMatrixBase::evalTo
void evalTo(MatrixBase< DenseDerived > &dst) const
Definition: SkylineMatrixBase.h:186
Eigen::RowMajorBit
const unsigned int RowMajorBit
Definition: Constants.h:66
ret
DenseIndex ret
Definition: level1_cplx_impl.h:44
EIGEN_CONSTEXPR
#define EIGEN_CONSTEXPR
Definition: Macros.h:787
Eigen::SkylineMatrixBase::rows
EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Definition: SkylineMatrixBase.h:105
Eigen::SkylineMatrixBase::MaxSizeAtCompileTime
@ MaxSizeAtCompileTime
Definition: SkylineMatrixBase.h:56
Eigen::SkylineMatrixBase
Base class of any skyline matrices or skyline expressions.
Definition: SkylineMatrixBase.h:26
EIGEN_SIZE_MAX
#define EIGEN_SIZE_MAX(a, b)
Definition: Macros.h:1310
Eigen::SkylineMatrixBase::markAsRValue
Derived & markAsRValue()
Definition: SkylineMatrixBase.h:142
Eigen::SkylineProduct
Definition: SkylineUtil.h:22
Eigen::SkylineMatrixBase::SquareMatrixType
Matrix< Scalar, EIGEN_SIZE_MAX(RowsAtCompileTime, ColsAtCompileTime), EIGEN_SIZE_MAX(RowsAtCompileTime, ColsAtCompileTime) > SquareMatrixType
Definition: SkylineMatrixBase.h:89
Eigen::SkylineMatrixBase::size
EIGEN_CONSTEXPR Index size() const EIGEN_NOEXCEPT
Definition: SkylineMatrixBase.h:116
Eigen::SkylineMatrixBase::toDense
Matrix< Scalar, RowsAtCompileTime, ColsAtCompileTime > toDense() const
Definition: SkylineMatrixBase.h:193
Eigen::SkylineMatrixBase::m_isRValue
bool m_isRValue
Definition: SkylineMatrixBase.h:207
Eigen::SkylineMatrixBase::derived
Derived & derived()
Definition: SkylineMatrixBase.h:95
Eigen::SkylineMatrixBase::Index
internal::index< StorageKind >::type Index
Definition: SkylineMatrixBase.h:31
j
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2
Eigen::SkylineMatrixBase::Scalar
internal::traits< Derived >::Scalar Scalar
Definition: SkylineMatrixBase.h:29
Eigen::SkylineMatrixBase::operator<<
friend std::ostream & operator<<(std::ostream &s, const SkylineMatrixBase &m)
Definition: SkylineMatrixBase.h:175
EIGEN_STRONG_INLINE
#define EIGEN_STRONG_INLINE
Definition: Macros.h:917
Eigen::SkylineMatrixBase::SkylineMatrixBase
SkylineMatrixBase()
Definition: SkylineMatrixBase.h:147
Eigen::SkylineMatrixBase::operator=
Derived & operator=(const Derived &other)
Definition: SkylineMatrixBase.h:151
Eigen::SkylineMatrixBase::IsVectorAtCompileTime
@ IsVectorAtCompileTime
Definition: SkylineMatrixBase.h:59
Eigen::SkylineMatrixBase::nonZeros
Index nonZeros() const
Definition: SkylineMatrixBase.h:122
m
Matrix3f m
Definition: AngleAxis_mimic_euler.cpp:1
Eigen::SkylineMatrixBase::ColsAtCompileTime
@ ColsAtCompileTime
Definition: SkylineMatrixBase.h:40
Eigen::SkylineMatrixBase::operator=
Derived & operator=(const SkylineMatrixBase< OtherDerived > &other)
Definition: SkylineMatrixBase.h:168
Eigen::SkylineMatrixBase::const_cast_derived
Derived & const_cast_derived() const
Definition: SkylineMatrixBase.h:99
Eigen::SkylineMatrixBase::isRValue
bool isRValue() const
Definition: SkylineMatrixBase.h:138
Eigen::SkylineMatrixBase::innerSize
Index innerSize() const
Definition: SkylineMatrixBase.h:134
Eigen::internal::traits
Definition: ForwardDeclarations.h:17
Eigen::SkylineMatrixBase::IsRowMajor
@ IsRowMajor
Definition: SkylineMatrixBase.h:75
row
m row(1)
Eigen::SkylineMatrixBase::StorageKind
internal::traits< Derived >::StorageKind StorageKind
Definition: SkylineMatrixBase.h:30
Eigen::SkylineMatrixBase::Flags
@ Flags
Definition: SkylineMatrixBase.h:65
Eigen::SkylineMatrixBase::assignGeneric
void assignGeneric(const OtherDerived &other)
Definition: SkylineMatrixBase.h:157
product
void product(const MatrixType &m)
Definition: product.h:20
Eigen::SkylineMatrixBase::MaxRowsAtCompileTime
@ MaxRowsAtCompileTime
Definition: SkylineMatrixBase.h:53
Eigen::SkylineMatrixBase::RowsAtCompileTime
@ RowsAtCompileTime
Definition: SkylineMatrixBase.h:34
Eigen::Matrix
The matrix class, also used for vectors and row-vectors.
Definition: 3rdparty/Eigen/Eigen/src/Core/Matrix.h:178
Eigen::SkylineMatrixBase::cols
EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition: SkylineMatrixBase.h:110
EIGEN_NOEXCEPT
#define EIGEN_NOEXCEPT
Definition: Macros.h:1418
Eigen::SkylineMatrixBase::outerSize
Index outerSize() const
Definition: SkylineMatrixBase.h:128
Eigen::MatrixBase
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48
SkylineUtil.h
Eigen::SkylineMatrixBase::derived
const Derived & derived() const
Definition: SkylineMatrixBase.h:91
Eigen::SkylineMatrixBase::MaxColsAtCompileTime
@ MaxColsAtCompileTime
Definition: SkylineMatrixBase.h:54
Eigen::SkylineMatrixBase::eval
const EIGEN_STRONG_INLINE internal::eval< Derived, IsSkyline >::type eval() const
Definition: SkylineMatrixBase.h:202
Eigen::SkylineMatrixBase::CoeffReadCost
@ CoeffReadCost
Definition: SkylineMatrixBase.h:70
Eigen::internal::eval
Definition: XprHelper.h:332
Eigen::SkylineMatrixBase::SizeAtCompileTime
@ SizeAtCompileTime
Definition: SkylineMatrixBase.h:47
Eigen::NumTraits
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition: NumTraits.h:232
i
int i
Definition: BiCGSTAB_step_by_step.cpp:9
pybind_wrapper_test_script.other
other
Definition: pybind_wrapper_test_script.py:42
Eigen::internal::size_at_compile_time
Definition: XprHelper.h:281


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:04:20