10#ifndef EIGEN_MATRIX_FUNCTION_H
11#define EIGEN_MATRIX_FUNCTION_H
21static const float matrix_function_separation = 0.1f;
29template <
typename MatrixType>
34 typedef typename MatrixType::Scalar
Scalar;
52template <
typename MatrixType>
60 return e.cwiseAbs().maxCoeff();
63template <
typename MatrixType>
107template <
typename Index,
typename ListOfClusters>
110 typename std::list<Index>::iterator
j;
112 j = std::find(
i->begin(),
i->end(), key);
130template <
typename EivalsType,
typename Cluster>
133 typedef typename EivalsType::RealScalar
RealScalar;
148 && std::find(
qi->begin(),
qi->end(),
j) ==
qi->end()) {
153 qi->insert(
qi->end(),
qj->begin(),
qj->end());
162template <
typename ListOfClusters,
typename Index>
175template <
typename VectorType>
186template <
typename EivalsType,
typename ListOfClusters,
typename VectorType>
202template <
typename DynVectorType,
typename VectorType>
215template <
typename VectorType,
typename MatrixType>
218 for (
Index i = 0;
i < permutation.rows() - 1;
i++) {
220 for (
j =
i;
j < permutation.rows();
j++) {
221 if (permutation(
j) ==
i)
break;
224 for (
Index k =
j-1; k >=
i; k--) {
226 rotation.makeGivens(
T(k, k+1),
T(k+1, k+1) -
T(k, k));
227 T.applyOnTheLeft(k, k+1,
rotation.adjoint());
230 std::swap(permutation.coeffRef(k), permutation.coeffRef(k+1));
241template <
typename MatrixType,
typename AtomicType,
typename VectorType>
244 fT.setZero(
T.rows(),
T.cols());
273template <
typename MatrixType>
283 typedef typename MatrixType::Scalar
Scalar;
322template <
typename MatrixType,
typename VectorType>
326 typedef typename MatrixType::Scalar
Scalar;
327 static const int Options = MatrixType::Options;
366template <typename MatrixType, int IsComplex = NumTraits<typename internal::traits<MatrixType>::Scalar>
::IsComplex>
379 template <
typename AtomicType,
typename ResultType>
389template <
typename MatrixType>
392 template <
typename MatA,
typename AtomicType,
typename ResultType>
396 typedef typename Traits::Scalar
Scalar;
397 static const int Rows = Traits::RowsAtCompileTime, Cols = Traits::ColsAtCompileTime;
398 static const int MaxRows = Traits::MaxRowsAtCompileTime, MaxCols = Traits::MaxColsAtCompileTime;
400 typedef std::complex<Scalar> ComplexScalar;
413template <
typename MatrixType>
416 template <
typename MatA,
typename AtomicType,
typename ResultType>
428 std::list<std::list<Index> >
clusters;
493 template <
typename ResultType>
494 inline void evalTo(ResultType& result)
const
499 typedef std::complex<typename NumTraits<Scalar>::Real> ComplexScalar;
503 AtomicType atomic(m_f);
517template<
typename Derived>
518struct traits<MatrixFunctionReturnValue<Derived> >
520 typedef typename Derived::PlainObject ReturnType;
528template <
typename Derived>
535template <
typename Derived>
543template <
typename Derived>
544const MatrixFunctionReturnValue<Derived> MatrixBase<Derived>::cos()
const
548 return MatrixFunctionReturnValue<Derived>(derived(), internal::stem_function_cos<ComplexScalar>);
551template <
typename Derived>
552const MatrixFunctionReturnValue<Derived> MatrixBase<Derived>::sinh()
const
556 return MatrixFunctionReturnValue<Derived>(derived(), internal::stem_function_sinh<ComplexScalar>);
559template <
typename Derived>
560const MatrixFunctionReturnValue<Derived> MatrixBase<Derived>::cosh()
const
564 return MatrixFunctionReturnValue<Derived>(derived(), internal::stem_function_cosh<ComplexScalar>);
Matrix3f m
Definition AngleAxis_mimic_euler.cpp:1
int n
Definition BiCGSTAB_simple.cpp:1
int i
Definition BiCGSTAB_step_by_step.cpp:9
cout<< "Here is a random 4x4 matrix, A:"<< endl<< A<< endl<< endl;ComplexSchur< MatrixXcf > schurOfA(A, false)
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Projective3d P(Matrix4d::Random())
#define eigen_assert(x)
Definition Macros.h:1037
VectorXcd eivals
Definition MatrixBase_eigenvalues.cpp:2
float rotation
Definition main.cpp:46
int rows
Definition Tutorial_commainit_02.cpp:1
int cols
Definition Tutorial_commainit_02.cpp:1
Eigen::Triplet< double > T
Definition Tutorial_sparse_example.cpp:6
SCALAR Scalar
Definition bench_gemm.cpp:46
Matrix< Scalar, Dynamic, Dynamic > C
Definition bench_gemm.cpp:50
NumTraits< Scalar >::Real RealScalar
Definition bench_gemm.cpp:47
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
Definition bench_gemm.cpp:48
Matrix< SCALARB, Dynamic, Dynamic, opt_B > B
Definition bench_gemm.cpp:49
MatrixXf MatrixType
Definition benchmark-blocking-sizes.cpp:52
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:50
const MatrixFunctionReturnValue< Derived > matrixFunction(StemFunction f) const
Helper function for the unsupported MatrixFunctions module.
Definition MatrixFunction.h:529
Proxy for the matrix function of some matrix (expression).
Definition MatrixFunction.h:472
internal::ref_selector< Derived >::type DerivedNested
Definition MatrixFunction.h:478
Index rows() const
Definition MatrixFunction.h:508
internal::stem_function< Scalar >::type StemFunction
Definition MatrixFunction.h:475
void evalTo(ResultType &result) const
Compute the matrix function.
Definition MatrixFunction.h:494
Index cols() const
Definition MatrixFunction.h:509
Derived::Scalar Scalar
Definition MatrixFunction.h:474
MatrixFunctionReturnValue(const Derived &A, StemFunction f)
Constructor.
Definition MatrixFunction.h:487
The matrix class, also used for vectors and row-vectors.
Definition Matrix.h:180
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition PlainObjectBase.h:145
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Definition PlainObjectBase.h:143
Definition ReturnByValue.h:52
Helper class for computing matrix functions of atomic matrices.
Definition MatrixFunction.h:31
MatrixFunctionAtomic(StemFunction f)
Constructor.
Definition MatrixFunction.h:40
MatrixType::Scalar Scalar
Definition MatrixFunction.h:34
MatrixType compute(const MatrixType &A)
Compute matrix function of atomic matrix.
Definition MatrixFunction.h:64
stem_function< Scalar >::type StemFunction
Definition MatrixFunction.h:35
Definition TensorRef.h:81
@ IsComplex
Definition common.h:98
@ N
Definition constructor.cpp:23
#define abs(x)
Definition datatypes.h:17
@ Success
Definition Constants.h:442
#define X
Definition icosphere.cpp:20
RealScalar s
Definition level1_cplx_impl.h:126
void matrix_function_compute_permutation(const DynVectorType &blockStart, const DynVectorType &eivalToCluster, VectorType &permutation)
Compute permutation which groups ei'vals in same cluster together.
Definition MatrixFunction.h:203
void matrix_function_compute_cluster_size(const ListOfClusters &clusters, Matrix< Index, Dynamic, 1 > &clusterSize)
Compute size of each cluster given a partitioning.
Definition MatrixFunction.h:163
void matrix_function_compute_block_start(const VectorType &clusterSize, VectorType &blockStart)
Compute start of each block using clusterSize.
Definition MatrixFunction.h:176
void matrix_function_compute_block_atomic(const MatrixType &T, AtomicType &atomic, const VectorType &blockStart, const VectorType &clusterSize, MatrixType &fT)
Compute block diagonal part of matrix function.
Definition MatrixFunction.h:242
void matrix_function_permute_schur(VectorType &permutation, MatrixType &U, MatrixType &T)
Permute Schur decomposition in U and T according to permutation.
Definition MatrixFunction.h:216
void matrix_function_compute_above_diagonal(const MatrixType &T, const VectorType &blockStart, const VectorType &clusterSize, MatrixType &fT)
Compute part of matrix function above block diagonal.
Definition MatrixFunction.h:323
void matrix_function_partition_eigenvalues(const EivalsType &eivals, std::list< Cluster > &clusters)
Partition eigenvalues in clusters of ei'vals close to each other.
Definition MatrixFunction.h:131
MatrixType matrix_function_solve_triangular_sylvester(const MatrixType &A, const MatrixType &B, const MatrixType &C)
Solve a triangular Sylvester equation AX + XB = C.
Definition MatrixFunction.h:274
void matrix_function_compute_map(const EivalsType &eivals, const ListOfClusters &clusters, VectorType &eivalToCluster)
Compute mapping of eigenvalue indices to cluster indices.
Definition MatrixFunction.h:187
NumTraits< typenameMatrixType::Scalar >::Real matrix_function_compute_mu(const MatrixType &A)
Definition MatrixFunction.h:53
ListOfClusters::iterator matrix_function_find_cluster(Index key, ListOfClusters &clusters)
Find cluster in clusters containing some value.
Definition MatrixFunction.h:108
Namespace containing all symbols from the Eigen library.
Definition bench_norm.cpp:85
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:74
Definition BandTriangularSolver.h:13
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition NumTraits.h:233
static void run(const MatA &A, AtomicType &atomic, ResultType &result)
Definition MatrixFunction.h:393
static void run(const MatA &A, AtomicType &atomic, ResultType &result)
Definition MatrixFunction.h:417
Class for computing matrix functions.
Definition MatrixFunction.h:368
static void run(const MatrixType &A, AtomicType &atomic, ResultType &result)
Compute the matrix function.
Definition ForwardDeclarations.h:314
std::complex< typename NumTraits< Scalar >::Real > ComplexScalar
Definition ForwardDeclarations.h:315
Definition ForwardDeclarations.h:17
std::ptrdiff_t j
Definition tut_arithmetic_redux_minmax.cpp:2