SyTen
syten::DenseEigensolver::DenseEigensolverBase< Type > Struct Template Reference

Dense nonsymmetric eigensolver, nonfunctional templated inheritance base. More...

#include <dense_eigensolver.h>

+ Inheritance diagram for syten::DenseEigensolver::DenseEigensolverBase< Type >:
+ Collaboration diagram for syten::DenseEigensolver::DenseEigensolverBase< Type >:

Public Types

typedef Type Scalar
 The scalar type to be used. More...
 

Public Attributes

DenseTensor< 1, Scalarevalues
 Vector of eigenvalues, unsorted! More...
 
DenseTensor< 2, Scalarleft_evectors
 Matrix of left eigenvectors, each row contains one complex-conjugated vector. More...
 
DenseTensor< 2, Scalarright_evectors
 Matrix of right eigenvectors, each row contains one eigenvector. More...
 

Detailed Description

template<typename Type>
struct syten::DenseEigensolver::DenseEigensolverBase< Type >

Dense nonsymmetric eigensolver, nonfunctional templated inheritance base.

Example usage:

namespace syten {
int main(int argc, char** argv) {
Index sidelength{3};
opt.add_options()
("length,l", boost::program_options::value(&sidelength), "sidelength")
;
auto mat = DenseTensor<2>({sidelength, sidelength});
makeRandom(mat); // generate the matrix
auto solver = DenseEigensolver::DenseEigensolver<SDef>(transpose(mat), true, true);
// build diagonal matrix
DenseTensor<2> diag({sidelength, sidelength});
for(Index i(0); i != sidelength; ++i) {
diag[{i,i}] = solver.evalues[i];
}
auto lvecs = conj(solver.left_evectors); // matrix of left eigenvectors, one per row
auto lm = prodD<1>(lvecs, mat, {-1, 1}, {1, -2});
auto dl = prodD<1>(diag, lvecs, {-1, 1}, {1, -2});
std::cerr << norm(lm-dl) << "\n";
auto rvecs = transpose(solver.right_evectors); // matrix of right eigenvectors, one per column
auto mr = prodD<1>(mat, rvecs, {-1, 1}, {1, -2});
auto rd = prodD<1>(rvecs, diag, {-1, 1}, {1, -2});
std::cerr << norm(mr-rd) << "\n";
return 0;
}
}
int main(int argc, char** argv) { return syten::main(argc, argv); }
#define SYTEN_BPO_EXEC
End the boost::program_options section with this.
Definition: bpo_helper.h:67
#define SYTEN_BPO_INIT
Start the boost::program_options section with this.
Definition: bpo_helper.h:50
Helper macros to handle repetitive use of boost::program_options.
DenseTensor support.
Convenience functions for dense tensors, to be included by dense.h.
Eigensolver for a single dense tensor.
Dense tensor generators.
Operators acting on DenseTensor.
Implementation of products/contractions of dense tensors.
Transposing a DenseTensor.
std::uint32_t Index
The standard index type for tensors, see also Scalar types.
Definition: scalars.h:25
void makeRandom(DenseTensor< rank, Scalar > &a, double b=-2., double e=2.)
Fills the tensor with random values between b and e.
Definition: dense_make.h:12
ScalarBase< Scalar >::type norm(DenseTensor< rank, Scalar > const &a)
, see abs()
Definition: dense_convenience.h:121
DenseTensor< rank, Scalar > conj(DenseTensor< rank, Scalar > const &a)
Returns the element-wise complex-conjugate of a
Definition: dense_conj.h:21
void transpose(ConstSpan< Scalar > const inp, MutSpan< Scalar > out, ConstSpan< Index > in_perm, ConstSpan< Index > in_dim, Conj do_conj=Conj::n(), bool do_checks=true)
Entry point for transposition of a continuous array into another array.
Definition: dense_transpose.h:373
Syten namespace.
Definition: basis-trafo.cpp:8
Dense nonsymmetric eigensolver, nonfunctional template base.
Definition: dense_eigensolver.h:130

Note that (in the language above), lvecs·mat·rvecs is typically not diag. To achieve this, you need to scale either the rows of lvecs or the columns of rvecs by the factor diag[i,i]/(lvecs·mat·rvecs)[i,i]. This ambiguity is due to the matrix being nonsymmetric in general and hence there being no easy relation between lvecs and rvecs (or their product being orthogonal which would otherwise allow normalisation).


The documentation for this struct was generated from the following file: