PackedSelfadjointProduct.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) 2012 Chen-Pang He <jdh8@ms63.hinet.net>
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_SELFADJOINT_PACKED_PRODUCT_H
11 #define EIGEN_SELFADJOINT_PACKED_PRODUCT_H
12 
13 namespace internal {
14 
15 /* Optimized matrix += alpha * uv'
16  * The matrix is in packed form.
17  */
18 template<typename Scalar, typename Index, int StorageOrder, int UpLo, bool ConjLhs, bool ConjRhs>
20 
21 template<typename Scalar, typename Index, int UpLo, bool ConjLhs, bool ConjRhs>
23 {
25  static void run(Index size, Scalar* mat, const Scalar* vec, RealScalar alpha)
26  {
27  typedef Map<const Matrix<Scalar,Dynamic,1> > OtherMap;
28  typedef typename conj_expr_if<ConjLhs,OtherMap>::type ConjRhsType;
29  conj_if<ConjRhs> cj;
30 
31  for (Index i=0; i<size; ++i)
32  {
33  Map<Matrix<Scalar,Dynamic,1> >(mat, UpLo==Lower ? size-i : (i+1)) += alpha * cj(vec[i]) * ConjRhsType(OtherMap(vec+(UpLo==Lower ? i : 0), UpLo==Lower ? size-i : (i+1)));
34  //FIXME This should be handled outside.
35  mat[UpLo==Lower ? 0 : i] = numext::real(mat[UpLo==Lower ? 0 : i]);
36  mat += UpLo==Lower ? size-i : (i+1);
37  }
38  }
39 };
40 
41 template<typename Scalar, typename Index, int UpLo, bool ConjLhs, bool ConjRhs>
43 {
45  static void run(Index size, Scalar* mat, const Scalar* vec, RealScalar alpha)
46  {
48  }
49 };
50 
51 } // end namespace internal
52 
53 #endif // EIGEN_SELFADJOINT_PACKED_PRODUCT_H
internal::selfadjoint_packed_rank1_update
Definition: PackedSelfadjointProduct.h:19
gtsam.examples.DogLegOptimizerExample.type
type
Definition: DogLegOptimizerExample.py:111
alpha
RealScalar alpha
Definition: level1_cplx_impl.h:147
real
float real
Definition: datatypes.h:10
internal::selfadjoint_packed_rank1_update< Scalar, Index, RowMajor, UpLo, ConjLhs, ConjRhs >::run
static void run(Index size, Scalar *mat, const Scalar *vec, RealScalar alpha)
Definition: PackedSelfadjointProduct.h:45
Eigen::RowMajor
@ RowMajor
Definition: Constants.h:321
mat
MatrixXf mat
Definition: Tutorial_AdvancedInitialization_CommaTemporary.cpp:1
size
Scalar Scalar int size
Definition: benchVecAdd.cpp:17
gtsam.examples.DogLegOptimizerExample.run
def run(args)
Definition: DogLegOptimizerExample.py:21
Eigen::Lower
@ Lower
Definition: Constants.h:209
internal::selfadjoint_packed_rank1_update< Scalar, Index, RowMajor, UpLo, ConjLhs, ConjRhs >::RealScalar
NumTraits< Scalar >::Real RealScalar
Definition: PackedSelfadjointProduct.h:44
internal
Definition: BandTriangularSolver.h:13
Eigen::ColMajor
@ ColMajor
Definition: Constants.h:319
internal::selfadjoint_packed_rank1_update< Scalar, Index, ColMajor, UpLo, ConjLhs, ConjRhs >::run
static void run(Index size, Scalar *mat, const Scalar *vec, RealScalar alpha)
Definition: PackedSelfadjointProduct.h:25
i
int i
Definition: BiCGSTAB_step_by_step.cpp:9
internal::selfadjoint_packed_rank1_update< Scalar, Index, ColMajor, UpLo, ConjLhs, ConjRhs >::RealScalar
NumTraits< Scalar >::Real RealScalar
Definition: PackedSelfadjointProduct.h:24
Eigen::GenericNumTraits< Scalar >::Real
Scalar Real
Definition: NumTraits.h:164
Scalar
SCALAR Scalar
Definition: bench_gemm.cpp:46
Eigen::Index
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74


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