Hermitians of matrices are calculated as conjugates of transposed:
#include <iostream> #include <boost/numeric/mtl/mtl.hpp> int main(int argc, char* argv[]) { using namespace mtl; typedef std::complex<double> cdouble; const unsigned xd= 2, yd= 5, n= xd * yd; compressed2D<cdouble> A(n, n); matrix::laplacian_setup(A, xd, yd); // Fill imaginary part of the matrix A*= cdouble(1, -1); std::cout << "A is\n" << with_format(A, 7, 1) << "\n"; std::cout << "trace(A) is " << trace(A) << "\n\n"; std::cout << "conj(A) is\n" << with_format(conj(A), 7, 1) << "\n"; std::cout << "trans(A) is\n" << with_format(trans(A), 7, 1) << "\n"; std::cout << "hermitian(A) is\n" << with_format(hermitian(A), 7, 1) << "\n"; return 0; }
It returns an immutable view on the matrix (expression).
Return to Transposed Table of Content Proceed to Sub-matrices
Hermitian -- MTL 4 -- Peter Gottschling and Andrew Lumsdaine
-- Generated on 19 May 2009 by Doxygen 1.5.5 -- Copyright 2007 by the Trustees of Indiana University.