Eigen  3.2.93
SparseSelfAdjointView.h
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2009-2014 Gael Guennebaud <gael.guennebaud@inria.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_SPARSE_SELFADJOINTVIEW_H
11 #define EIGEN_SPARSE_SELFADJOINTVIEW_H
12 
13 namespace Eigen {
14 
29 namespace internal {
30 
31 template<typename MatrixType, unsigned int Mode>
32 struct traits<SparseSelfAdjointView<MatrixType,Mode> > : traits<MatrixType> {
33 };
34 
35 template<int SrcMode,int DstMode,typename MatrixType,int DestOrder>
36 void permute_symm_to_symm(const MatrixType& mat, SparseMatrix<typename MatrixType::Scalar,DestOrder,typename MatrixType::StorageIndex>& _dest, const typename MatrixType::StorageIndex* perm = 0);
37 
38 template<int Mode,typename MatrixType,int DestOrder>
39 void permute_symm_to_fullsymm(const MatrixType& mat, SparseMatrix<typename MatrixType::Scalar,DestOrder,typename MatrixType::StorageIndex>& _dest, const typename MatrixType::StorageIndex* perm = 0);
40 
41 }
42 
43 template<typename MatrixType, unsigned int _Mode> class SparseSelfAdjointView
44  : public EigenBase<SparseSelfAdjointView<MatrixType,_Mode> >
45 {
46  public:
47 
48  enum {
49  Mode = _Mode,
50  RowsAtCompileTime = internal::traits<SparseSelfAdjointView>::RowsAtCompileTime,
51  ColsAtCompileTime = internal::traits<SparseSelfAdjointView>::ColsAtCompileTime
52  };
53 
55  typedef typename MatrixType::Scalar Scalar;
56  typedef typename MatrixType::StorageIndex StorageIndex;
58  typedef typename internal::ref_selector<MatrixType>::non_const_type MatrixTypeNested;
59  typedef typename internal::remove_all<MatrixTypeNested>::type _MatrixTypeNested;
60 
61  explicit inline SparseSelfAdjointView(MatrixType& matrix) : m_matrix(matrix)
62  {
63  eigen_assert(rows()==cols() && "SelfAdjointView is only for squared matrices");
64  }
65 
66  inline Index rows() const { return m_matrix.rows(); }
67  inline Index cols() const { return m_matrix.cols(); }
68 
70  const _MatrixTypeNested& matrix() const { return m_matrix; }
71  typename internal::remove_reference<MatrixTypeNested>::type& matrix() { return m_matrix; }
72 
78  template<typename OtherDerived>
81  {
83  }
84 
90  template<typename OtherDerived> friend
93  {
95  }
96 
98  template<typename OtherDerived>
101  {
103  }
104 
106  template<typename OtherDerived> friend
109  {
111  }
112 
121  template<typename DerivedU>
122  SparseSelfAdjointView& rankUpdate(const SparseMatrixBase<DerivedU>& u, const Scalar& alpha = Scalar(1));
123 
125  // TODO implement twists in a more evaluator friendly fashion
126  SparseSymmetricPermutationProduct<_MatrixTypeNested,Mode> twistedBy(const PermutationMatrix<Dynamic,Dynamic,StorageIndex>& perm) const
127  {
128  return SparseSymmetricPermutationProduct<_MatrixTypeNested,Mode>(m_matrix, perm);
129  }
130 
131  template<typename SrcMatrixType,int SrcMode>
132  SparseSelfAdjointView& operator=(const SparseSymmetricPermutationProduct<SrcMatrixType,SrcMode>& permutedMatrix)
133  {
134  internal::call_assignment_no_alias_no_transpose(*this, permutedMatrix);
135  return *this;
136  }
137 
138  SparseSelfAdjointView& operator=(const SparseSelfAdjointView& src)
139  {
141  return *this = src.twistedBy(pnull);
142  }
143 
144  template<typename SrcMatrixType,unsigned int SrcMode>
146  {
148  return *this = src.twistedBy(pnull);
149  }
150 
151  void resize(Index rows, Index cols)
152  {
153  EIGEN_ONLY_USED_FOR_DEBUG(rows);
154  EIGEN_ONLY_USED_FOR_DEBUG(cols);
155  eigen_assert(rows == this->rows() && cols == this->cols()
156  && "SparseSelfadjointView::resize() does not actually allow to resize.");
157  }
158 
159  protected:
160 
161  MatrixTypeNested m_matrix;
162  //mutable VectorI m_countPerRow;
163  //mutable VectorI m_countPerCol;
164  private:
165  template<typename Dest> void evalTo(Dest &) const;
166 };
167 
168 /***************************************************************************
169 * Implementation of SparseMatrixBase methods
170 ***************************************************************************/
171 
172 template<typename Derived>
173 template<unsigned int UpLo>
174 typename SparseMatrixBase<Derived>::template ConstSelfAdjointViewReturnType<UpLo>::Type SparseMatrixBase<Derived>::selfadjointView() const
175 {
177 }
178 
179 template<typename Derived>
180 template<unsigned int UpLo>
181 typename SparseMatrixBase<Derived>::template SelfAdjointViewReturnType<UpLo>::Type SparseMatrixBase<Derived>::selfadjointView()
182 {
183  return SparseSelfAdjointView<Derived, UpLo>(derived());
184 }
185 
186 /***************************************************************************
187 * Implementation of SparseSelfAdjointView methods
188 ***************************************************************************/
189 
190 template<typename MatrixType, unsigned int Mode>
191 template<typename DerivedU>
194 {
196  if(alpha==Scalar(0))
197  m_matrix = tmp.template triangularView<Mode>();
198  else
199  m_matrix += alpha * tmp.template triangularView<Mode>();
200 
201  return *this;
202 }
203 
204 namespace internal {
205 
206 // TODO currently a selfadjoint expression has the form SelfAdjointView<.,.>
207 // in the future selfadjoint-ness should be defined by the expression traits
208 // such that Transpose<SelfAdjointView<.,.> > is valid. (currently TriangularBase::transpose() is overloaded to make it work)
209 template<typename MatrixType, unsigned int Mode>
210 struct evaluator_traits<SparseSelfAdjointView<MatrixType,Mode> >
211 {
212  typedef typename storage_kind_to_evaluator_kind<typename MatrixType::StorageKind>::Kind Kind;
213  typedef SparseSelfAdjointShape Shape;
214 };
215 
216 struct SparseSelfAdjoint2Sparse {};
217 
218 template<> struct AssignmentKind<SparseShape,SparseSelfAdjointShape> { typedef SparseSelfAdjoint2Sparse Kind; };
219 template<> struct AssignmentKind<SparseSelfAdjointShape,SparseShape> { typedef Sparse2Sparse Kind; };
220 
221 template< typename DstXprType, typename SrcXprType, typename Functor>
222 struct Assignment<DstXprType, SrcXprType, Functor, SparseSelfAdjoint2Sparse>
223 {
224  typedef typename DstXprType::StorageIndex StorageIndex;
225  template<typename DestScalar,int StorageOrder>
226  static void run(SparseMatrix<DestScalar,StorageOrder,StorageIndex> &dst, const SrcXprType &src, const internal::assign_op<typename DstXprType::Scalar,typename SrcXprType::Scalar> &/*func*/)
227  {
228  internal::permute_symm_to_fullsymm<SrcXprType::Mode>(src.matrix(), dst);
229  }
230 
231  template<typename DestScalar>
232  static void run(DynamicSparseMatrix<DestScalar,ColMajor,StorageIndex>& dst, const SrcXprType &src, const internal::assign_op<typename DstXprType::Scalar,typename SrcXprType::Scalar> &/*func*/)
233  {
234  // TODO directly evaluate into dst;
235  SparseMatrix<DestScalar,ColMajor,StorageIndex> tmp(dst.rows(),dst.cols());
236  internal::permute_symm_to_fullsymm<SrcXprType::Mode>(src.matrix(), tmp);
237  dst = tmp;
238  }
239 };
240 
241 } // end namespace internal
242 
243 /***************************************************************************
244 * Implementation of sparse self-adjoint time dense matrix
245 ***************************************************************************/
246 
247 namespace internal {
248 
249 template<int Mode, typename SparseLhsType, typename DenseRhsType, typename DenseResType, typename AlphaType>
250 inline void sparse_selfadjoint_time_dense_product(const SparseLhsType& lhs, const DenseRhsType& rhs, DenseResType& res, const AlphaType& alpha)
251 {
252  EIGEN_ONLY_USED_FOR_DEBUG(alpha);
253  // TODO use alpha
254  eigen_assert(alpha==AlphaType(1) && "alpha != 1 is not implemented yet, sorry");
255 
256  typedef evaluator<SparseLhsType> LhsEval;
257  typedef typename evaluator<SparseLhsType>::InnerIterator LhsIterator;
258  typedef typename SparseLhsType::Scalar LhsScalar;
259 
260  enum {
261  LhsIsRowMajor = (LhsEval::Flags&RowMajorBit)==RowMajorBit,
262  ProcessFirstHalf =
263  ((Mode&(Upper|Lower))==(Upper|Lower))
264  || ( (Mode&Upper) && !LhsIsRowMajor)
265  || ( (Mode&Lower) && LhsIsRowMajor),
266  ProcessSecondHalf = !ProcessFirstHalf
267  };
268 
269  LhsEval lhsEval(lhs);
270 
271  for (Index j=0; j<lhs.outerSize(); ++j)
272  {
273  LhsIterator i(lhsEval,j);
274  if (ProcessSecondHalf)
275  {
276  while (i && i.index()<j) ++i;
277  if(i && i.index()==j)
278  {
279  res.row(j) += i.value() * rhs.row(j);
280  ++i;
281  }
282  }
283  for(; (ProcessFirstHalf ? i && i.index() < j : i) ; ++i)
284  {
285  Index a = LhsIsRowMajor ? j : i.index();
286  Index b = LhsIsRowMajor ? i.index() : j;
287  LhsScalar v = i.value();
288  res.row(a) += (v) * rhs.row(b);
289  res.row(b) += numext::conj(v) * rhs.row(a);
290  }
291  if (ProcessFirstHalf && i && (i.index()==j))
292  res.row(j) += i.value() * rhs.row(j);
293  }
294 }
295 
296 
297 template<typename LhsView, typename Rhs, int ProductType>
298 struct generic_product_impl<LhsView, Rhs, SparseSelfAdjointShape, DenseShape, ProductType>
299 {
300  template<typename Dest>
301  static void evalTo(Dest& dst, const LhsView& lhsView, const Rhs& rhs)
302  {
303  typedef typename LhsView::_MatrixTypeNested Lhs;
304  typedef typename nested_eval<Lhs,Dynamic>::type LhsNested;
305  typedef typename nested_eval<Rhs,Dynamic>::type RhsNested;
306  LhsNested lhsNested(lhsView.matrix());
307  RhsNested rhsNested(rhs);
308 
309  dst.setZero();
310  internal::sparse_selfadjoint_time_dense_product<LhsView::Mode>(lhsNested, rhsNested, dst, typename Dest::Scalar(1));
311  }
312 };
313 
314 template<typename Lhs, typename RhsView, int ProductType>
315 struct generic_product_impl<Lhs, RhsView, DenseShape, SparseSelfAdjointShape, ProductType>
316 {
317  template<typename Dest>
318  static void evalTo(Dest& dst, const Lhs& lhs, const RhsView& rhsView)
319  {
320  typedef typename RhsView::_MatrixTypeNested Rhs;
321  typedef typename nested_eval<Lhs,Dynamic>::type LhsNested;
322  typedef typename nested_eval<Rhs,Dynamic>::type RhsNested;
323  LhsNested lhsNested(lhs);
324  RhsNested rhsNested(rhsView.matrix());
325 
326  dst.setZero();
327  // transpoe everything
328  Transpose<Dest> dstT(dst);
329  internal::sparse_selfadjoint_time_dense_product<RhsView::Mode>(rhsNested.transpose(), lhsNested.transpose(), dstT, typename Dest::Scalar(1));
330  }
331 };
332 
333 // NOTE: these two overloads are needed to evaluate the sparse selfadjoint view into a full sparse matrix
334 // TODO: maybe the copy could be handled by generic_product_impl so that these overloads would not be needed anymore
335 
336 template<typename LhsView, typename Rhs, int ProductTag>
337 struct product_evaluator<Product<LhsView, Rhs, DefaultProduct>, ProductTag, SparseSelfAdjointShape, SparseShape>
338  : public evaluator<typename Product<typename Rhs::PlainObject, Rhs, DefaultProduct>::PlainObject>
339 {
341  typedef typename XprType::PlainObject PlainObject;
342  typedef evaluator<PlainObject> Base;
343 
344  product_evaluator(const XprType& xpr)
345  : m_lhs(xpr.lhs()), m_result(xpr.rows(), xpr.cols())
346  {
347  ::new (static_cast<Base*>(this)) Base(m_result);
348  generic_product_impl<typename Rhs::PlainObject, Rhs, SparseShape, SparseShape, ProductTag>::evalTo(m_result, m_lhs, xpr.rhs());
349  }
350 
351 protected:
352  typename Rhs::PlainObject m_lhs;
353  PlainObject m_result;
354 };
355 
356 template<typename Lhs, typename RhsView, int ProductTag>
357 struct product_evaluator<Product<Lhs, RhsView, DefaultProduct>, ProductTag, SparseShape, SparseSelfAdjointShape>
358  : public evaluator<typename Product<Lhs, typename Lhs::PlainObject, DefaultProduct>::PlainObject>
359 {
361  typedef typename XprType::PlainObject PlainObject;
362  typedef evaluator<PlainObject> Base;
363 
364  product_evaluator(const XprType& xpr)
365  : m_rhs(xpr.rhs()), m_result(xpr.rows(), xpr.cols())
366  {
367  ::new (static_cast<Base*>(this)) Base(m_result);
368  generic_product_impl<Lhs, typename Lhs::PlainObject, SparseShape, SparseShape, ProductTag>::evalTo(m_result, xpr.lhs(), m_rhs);
369  }
370 
371 protected:
372  typename Lhs::PlainObject m_rhs;
373  PlainObject m_result;
374 };
375 
376 } // namespace internal
377 
378 /***************************************************************************
379 * Implementation of symmetric copies and permutations
380 ***************************************************************************/
381 namespace internal {
382 
383 template<int Mode,typename MatrixType,int DestOrder>
384 void permute_symm_to_fullsymm(const MatrixType& mat, SparseMatrix<typename MatrixType::Scalar,DestOrder,typename MatrixType::StorageIndex>& _dest, const typename MatrixType::StorageIndex* perm)
385 {
386  typedef typename MatrixType::StorageIndex StorageIndex;
387  typedef typename MatrixType::Scalar Scalar;
390  typedef evaluator<MatrixType> MatEval;
391  typedef typename evaluator<MatrixType>::InnerIterator MatIterator;
392 
393  MatEval matEval(mat);
394  Dest& dest(_dest.derived());
395  enum {
396  StorageOrderMatch = int(Dest::IsRowMajor) == int(MatrixType::IsRowMajor)
397  };
398 
399  Index size = mat.rows();
400  VectorI count;
401  count.resize(size);
402  count.setZero();
403  dest.resize(size,size);
404  for(Index j = 0; j<size; ++j)
405  {
406  Index jp = perm ? perm[j] : j;
407  for(MatIterator it(matEval,j); it; ++it)
408  {
409  Index i = it.index();
410  Index r = it.row();
411  Index c = it.col();
412  Index ip = perm ? perm[i] : i;
413  if(Mode==(Upper|Lower))
414  count[StorageOrderMatch ? jp : ip]++;
415  else if(r==c)
416  count[ip]++;
417  else if(( Mode==Lower && r>c) || ( Mode==Upper && r<c))
418  {
419  count[ip]++;
420  count[jp]++;
421  }
422  }
423  }
424  Index nnz = count.sum();
425 
426  // reserve space
427  dest.resizeNonZeros(nnz);
428  dest.outerIndexPtr()[0] = 0;
429  for(Index j=0; j<size; ++j)
430  dest.outerIndexPtr()[j+1] = dest.outerIndexPtr()[j] + count[j];
431  for(Index j=0; j<size; ++j)
432  count[j] = dest.outerIndexPtr()[j];
433 
434  // copy data
435  for(StorageIndex j = 0; j<size; ++j)
436  {
437  for(MatIterator it(matEval,j); it; ++it)
438  {
439  StorageIndex i = internal::convert_index<StorageIndex>(it.index());
440  Index r = it.row();
441  Index c = it.col();
442 
443  StorageIndex jp = perm ? perm[j] : j;
444  StorageIndex ip = perm ? perm[i] : i;
445 
446  if(Mode==(Upper|Lower))
447  {
448  Index k = count[StorageOrderMatch ? jp : ip]++;
449  dest.innerIndexPtr()[k] = StorageOrderMatch ? ip : jp;
450  dest.valuePtr()[k] = it.value();
451  }
452  else if(r==c)
453  {
454  Index k = count[ip]++;
455  dest.innerIndexPtr()[k] = ip;
456  dest.valuePtr()[k] = it.value();
457  }
458  else if(( (Mode&Lower)==Lower && r>c) || ( (Mode&Upper)==Upper && r<c))
459  {
460  if(!StorageOrderMatch)
461  std::swap(ip,jp);
462  Index k = count[jp]++;
463  dest.innerIndexPtr()[k] = ip;
464  dest.valuePtr()[k] = it.value();
465  k = count[ip]++;
466  dest.innerIndexPtr()[k] = jp;
467  dest.valuePtr()[k] = numext::conj(it.value());
468  }
469  }
470  }
471 }
472 
473 template<int _SrcMode,int _DstMode,typename MatrixType,int DstOrder>
474 void permute_symm_to_symm(const MatrixType& mat, SparseMatrix<typename MatrixType::Scalar,DstOrder,typename MatrixType::StorageIndex>& _dest, const typename MatrixType::StorageIndex* perm)
475 {
476  typedef typename MatrixType::StorageIndex StorageIndex;
477  typedef typename MatrixType::Scalar Scalar;
480  typedef evaluator<MatrixType> MatEval;
481  typedef typename evaluator<MatrixType>::InnerIterator MatIterator;
482 
483  enum {
484  SrcOrder = MatrixType::IsRowMajor ? RowMajor : ColMajor,
485  StorageOrderMatch = int(SrcOrder) == int(DstOrder),
486  DstMode = DstOrder==RowMajor ? (_DstMode==Upper ? Lower : Upper) : _DstMode,
487  SrcMode = SrcOrder==RowMajor ? (_SrcMode==Upper ? Lower : Upper) : _SrcMode
488  };
489 
490  MatEval matEval(mat);
491 
492  Index size = mat.rows();
493  VectorI count(size);
494  count.setZero();
495  dest.resize(size,size);
496  for(StorageIndex j = 0; j<size; ++j)
497  {
498  StorageIndex jp = perm ? perm[j] : j;
499  for(MatIterator it(matEval,j); it; ++it)
500  {
501  StorageIndex i = it.index();
502  if((int(SrcMode)==int(Lower) && i<j) || (int(SrcMode)==int(Upper) && i>j))
503  continue;
504 
505  StorageIndex ip = perm ? perm[i] : i;
506  count[int(DstMode)==int(Lower) ? (std::min)(ip,jp) : (std::max)(ip,jp)]++;
507  }
508  }
509  dest.outerIndexPtr()[0] = 0;
510  for(Index j=0; j<size; ++j)
511  dest.outerIndexPtr()[j+1] = dest.outerIndexPtr()[j] + count[j];
512  dest.resizeNonZeros(dest.outerIndexPtr()[size]);
513  for(Index j=0; j<size; ++j)
514  count[j] = dest.outerIndexPtr()[j];
515 
516  for(StorageIndex j = 0; j<size; ++j)
517  {
518 
519  for(MatIterator it(matEval,j); it; ++it)
520  {
521  StorageIndex i = it.index();
522  if((int(SrcMode)==int(Lower) && i<j) || (int(SrcMode)==int(Upper) && i>j))
523  continue;
524 
525  StorageIndex jp = perm ? perm[j] : j;
526  StorageIndex ip = perm? perm[i] : i;
527 
528  Index k = count[int(DstMode)==int(Lower) ? (std::min)(ip,jp) : (std::max)(ip,jp)]++;
529  dest.innerIndexPtr()[k] = int(DstMode)==int(Lower) ? (std::max)(ip,jp) : (std::min)(ip,jp);
530 
531  if(!StorageOrderMatch) std::swap(ip,jp);
532  if( ((int(DstMode)==int(Lower) && ip<jp) || (int(DstMode)==int(Upper) && ip>jp)))
533  dest.valuePtr()[k] = numext::conj(it.value());
534  else
535  dest.valuePtr()[k] = it.value();
536  }
537  }
538 }
539 
540 }
541 
542 // TODO implement twists in a more evaluator friendly fashion
543 
544 namespace internal {
545 
546 template<typename MatrixType, int Mode>
547 struct traits<SparseSymmetricPermutationProduct<MatrixType,Mode> > : traits<MatrixType> {
548 };
549 
550 }
551 
552 template<typename MatrixType,int Mode>
553 class SparseSymmetricPermutationProduct
554  : public EigenBase<SparseSymmetricPermutationProduct<MatrixType,Mode> >
555 {
556  public:
557  typedef typename MatrixType::Scalar Scalar;
558  typedef typename MatrixType::StorageIndex StorageIndex;
559  enum {
560  RowsAtCompileTime = internal::traits<SparseSymmetricPermutationProduct>::RowsAtCompileTime,
561  ColsAtCompileTime = internal::traits<SparseSymmetricPermutationProduct>::ColsAtCompileTime
562  };
563  protected:
565  public:
567  typedef typename MatrixType::Nested MatrixTypeNested;
568  typedef typename internal::remove_all<MatrixTypeNested>::type NestedExpression;
569 
570  SparseSymmetricPermutationProduct(const MatrixType& mat, const Perm& perm)
571  : m_matrix(mat), m_perm(perm)
572  {}
573 
574  inline Index rows() const { return m_matrix.rows(); }
575  inline Index cols() const { return m_matrix.cols(); }
576 
577  const NestedExpression& matrix() const { return m_matrix; }
578  const Perm& perm() const { return m_perm; }
579 
580  protected:
581  MatrixTypeNested m_matrix;
582  const Perm& m_perm;
583 
584 };
585 
586 namespace internal {
587 
588 template<typename DstXprType, typename MatrixType, int Mode, typename Scalar>
589 struct Assignment<DstXprType, SparseSymmetricPermutationProduct<MatrixType,Mode>, internal::assign_op<Scalar,typename MatrixType::Scalar>, Sparse2Sparse>
590 {
591  typedef SparseSymmetricPermutationProduct<MatrixType,Mode> SrcXprType;
592  typedef typename DstXprType::StorageIndex DstIndex;
593  template<int Options>
594  static void run(SparseMatrix<Scalar,Options,DstIndex> &dst, const SrcXprType &src, const internal::assign_op<Scalar,typename MatrixType::Scalar> &)
595  {
596  // internal::permute_symm_to_fullsymm<Mode>(m_matrix,_dest,m_perm.indices().data());
598  internal::permute_symm_to_fullsymm<Mode>(src.matrix(),tmp,src.perm().indices().data());
599  dst = tmp;
600  }
601 
602  template<typename DestType,unsigned int DestMode>
603  static void run(SparseSelfAdjointView<DestType,DestMode>& dst, const SrcXprType &src, const internal::assign_op<Scalar,typename MatrixType::Scalar> &)
604  {
605  internal::permute_symm_to_symm<Mode,DestMode>(src.matrix(),dst.matrix(),src.perm().indices().data());
606  }
607 };
608 
609 } // end namespace internal
610 
611 } // end namespace Eigen
612 
613 #endif // EIGEN_SPARSE_SELFADJOINTVIEW_H
Product< SparseSelfAdjointView, OtherDerived > operator*(const SparseMatrixBase< OtherDerived > &rhs) const
Definition: SparseSelfAdjointView.h:80
Definition: Constants.h:320
Expression of the product of two arbitrary matrices or vectors.
Definition: Product.h:71
A versatible sparse matrix representation.
Definition: SparseMatrix.h:92
Expression of the transpose of a matrix.
Definition: Transpose.h:52
friend Product< OtherDerived, SparseSelfAdjointView > operator*(const SparseMatrixBase< OtherDerived > &lhs, const SparseSelfAdjointView &rhs)
Definition: SparseSelfAdjointView.h:92
friend Product< OtherDerived, SparseSelfAdjointView > operator*(const MatrixBase< OtherDerived > &lhs, const SparseSelfAdjointView &rhs)
Definition: SparseSelfAdjointView.h:108
Namespace containing all symbols from the Eigen library.
Definition: Core:271
Pseudo expression to manipulate a triangular sparse matrix as a selfadjoint matrix.
Definition: SparseSelfAdjointView.h:43
Derived & derived()
Definition: EigenBase.h:44
Eigen::Index Index
The interface type of indices.
Definition: EigenBase.h:37
const unsigned int RowMajorBit
Definition: Constants.h:61
void resize(Index rows, Index cols)
Definition: PlainObjectBase.h:273
Definition: EigenBase.h:28
Derived & setZero(Index size)
Definition: CwiseNullaryOp.h:519
Base class of any sparse matrices or sparse expressions.
Definition: ForwardDeclarations.h:281
Product< SparseSelfAdjointView, OtherDerived > operator*(const MatrixBase< OtherDerived > &rhs) const
Definition: SparseSelfAdjointView.h:100
Definition: Constants.h:204
Definition: Constants.h:206
Definition: Eigen_Colamd.h:50
SparseSelfAdjointView & rankUpdate(const SparseMatrixBase< DerivedU > &u, const Scalar &alpha=Scalar(1))
Definition: Constants.h:322
SparseSymmetricPermutationProduct< _MatrixTypeNested, Mode > twistedBy(const PermutationMatrix< Dynamic, Dynamic, StorageIndex > &perm) const
Definition: SparseSelfAdjointView.h:126
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48