Rank2Update.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_RANK2UPDATE_H
11 #define EIGEN_RANK2UPDATE_H
12 
13 namespace internal {
14 
15 /* Optimized selfadjoint matrix += alpha * uv' + conj(alpha)*vu'
16  * This is the low-level version of SelfadjointRank2Update.h
17  */
18 template<typename Scalar, typename Index, int UpLo>
20 {
21  static void run(Index size, Scalar* mat, Index stride, const Scalar* u, const Scalar* v, Scalar alpha)
22  {
23  typedef Map<const Matrix<Scalar,Dynamic,1> > OtherMap;
24  for (Index i=0; i<size; ++i)
25  {
26  Map<Matrix<Scalar,Dynamic,1> >(mat+stride*i+(UpLo==Lower ? i : 0), UpLo==Lower ? size-i : (i+1)) +=
27  numext::conj(alpha) * numext::conj(u[i]) * OtherMap(v+(UpLo==Lower ? i : 0), UpLo==Lower ? size-i : (i+1))
28  + alpha * numext::conj(v[i]) * OtherMap(u+(UpLo==Lower ? i : 0), UpLo==Lower ? size-i : (i+1));
29  }
30  }
31 };
32 
33 /* Optimized selfadjoint matrix += alpha * uv' + conj(alpha)*vu'
34  * The matrix is in packed form.
35  */
36 template<typename Scalar, typename Index, int UpLo>
38 {
39  static void run(Index size, Scalar* mat, const Scalar* u, const Scalar* v, Scalar alpha)
40  {
41  typedef Map<const Matrix<Scalar,Dynamic,1> > OtherMap;
42  Index offset = 0;
43  for (Index i=0; i<size; ++i)
44  {
45  Map<Matrix<Scalar,Dynamic,1> >(mat+offset, UpLo==Lower ? size-i : (i+1)) +=
46  numext::conj(alpha) * numext::conj(u[i]) * OtherMap(v+(UpLo==Lower ? i : 0), UpLo==Lower ? size-i : (i+1))
47  + alpha * numext::conj(v[i]) * OtherMap(u+(UpLo==Lower ? i : 0), UpLo==Lower ? size-i : (i+1));
48  //FIXME This should be handled outside.
49  mat[offset+(UpLo==Lower ? 0 : i)] = numext::real(mat[offset+(UpLo==Lower ? 0 : i)]);
50  offset += UpLo==Lower ? size-i : (i+1);
51  }
52  }
53 };
54 
55 } // end namespace internal
56 
57 #endif // EIGEN_RANK2UPDATE_H
SCALAR Scalar
Definition: bench_gemm.cpp:46
float real
Definition: datatypes.h:10
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy y set format x g set format y g set format x2 g set format y2 g set format z g set angles radians set nogrid set key title set key left top Right noreverse box linetype linewidth samplen spacing width set nolabel set noarrow set nologscale set logscale x set set pointsize set encoding default set nopolar set noparametric set set set set surface set nocontour set clabel set mapping cartesian set nohidden3d set cntrparam order set cntrparam linear set cntrparam levels auto set cntrparam points set size set set xzeroaxis lt lw set x2zeroaxis lt lw set yzeroaxis lt lw set y2zeroaxis lt lw set tics in set ticslevel set tics set mxtics default set mytics default set mx2tics default set my2tics default set xtics border mirror norotate autofreq set ytics border mirror norotate autofreq set ztics border nomirror norotate autofreq set nox2tics set noy2tics set timestamp bottom norotate offset
static void run(Index size, Scalar *mat, const Scalar *u, const Scalar *v, Scalar alpha)
Definition: Rank2Update.h:39
AnnoyingScalar conj(const AnnoyingScalar &x)
Scalar Scalar int size
Definition: benchVecAdd.cpp:17
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74
Array< int, Dynamic, 1 > v
RealScalar alpha
static void run(Index size, Scalar *mat, Index stride, const Scalar *u, const Scalar *v, Scalar alpha)
Definition: Rank2Update.h:21


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:35:29