GeneralRank1Update.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_GENERAL_RANK1UPDATE_H
11 #define EIGEN_GENERAL_RANK1UPDATE_H
12 
13 namespace Eigen {
14 namespace internal {
15 
16 /* Optimized matrix += alpha * uv' */
17 template <typename Scalar, typename Index, int StorageOrder, bool ConjLhs, bool ConjRhs>
19 
20 template <typename Scalar, typename Index, bool ConjLhs, bool ConjRhs>
21 struct general_rank1_update<Scalar, Index, ColMajor, ConjLhs, ConjRhs> {
22  static void run(Index rows, Index cols, Scalar* mat, Index stride, const Scalar* u, const Scalar* v, Scalar alpha) {
23  typedef Map<const Matrix<Scalar, Dynamic, 1> > OtherMap;
24  typedef typename conj_expr_if<ConjLhs, OtherMap>::type ConjRhsType;
26 
27  for (Index i = 0; i < cols; ++i)
28  Map<Matrix<Scalar, Dynamic, 1> >(mat + stride * i, rows) += alpha * cj(v[i]) * ConjRhsType(OtherMap(u, rows));
29  }
30 };
31 
32 template <typename Scalar, typename Index, bool ConjLhs, bool ConjRhs>
33 struct general_rank1_update<Scalar, Index, RowMajor, ConjLhs, ConjRhs> {
34  static void run(Index rows, Index cols, Scalar* mat, Index stride, const Scalar* u, const Scalar* v, Scalar alpha) {
36  }
37 };
38 
39 } // namespace internal
40 } // namespace Eigen
41 
42 #endif // EIGEN_GENERAL_RANK1UPDATE_H
Array< int, Dynamic, 1 > v
Definition: Array_initializer_list_vector_cxx11.cpp:1
int i
Definition: BiCGSTAB_step_by_step.cpp:9
int rows
Definition: Tutorial_commainit_02.cpp:1
int cols
Definition: Tutorial_commainit_02.cpp:1
SCALAR Scalar
Definition: bench_gemm.cpp:45
A matrix or vector expression mapping an existing array of data.
Definition: Map.h:96
@ ColMajor
Definition: Constants.h:318
@ RowMajor
Definition: Constants.h:320
RealScalar alpha
Definition: level1_cplx_impl.h:151
std::conditional<!Cond, const T &, CwiseUnaryOp< scalar_conjugate_op< typename traits< T >::Scalar >, T > > conj_expr_if
Definition: SelfadjointRank2Update.h:52
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
Definition: Eigen_Colamd.h:49
Definition: ConjHelper.h:42
static void run(Index rows, Index cols, Scalar *mat, Index stride, const Scalar *u, const Scalar *v, Scalar alpha)
Definition: GeneralRank1Update.h:22
static void run(Index rows, Index cols, Scalar *mat, Index stride, const Scalar *u, const Scalar *v, Scalar alpha)
Definition: GeneralRank1Update.h:34
Definition: GeneralRank1Update.h:18
void run(const string &dir_name, LinearSolver *linear_solver_pt, const unsigned nel_1d, bool mess_up_order)
Definition: two_d_poisson_compare_solvers.cc:317