#include <iostream> #include <boost/numeric/mtl/mtl.hpp> int main(int argc, char* argv[]) { using namespace mtl; const unsigned n= 10; compressed2D<double> A(n, n); dense2D<float, matrix::parameters<col_major> > B(n, n); morton_dense<double, 0x55555555> C(n, n); morton_dense<double, 0x555555f0> D(n, n); matrix::hessian_setup(B, 1.0); matrix::hessian_setup(C, 2.0); matrix::hessian_setup(D, 3.0); std::cout << "one_norm(B) is " << one_norm(B)<< "\n"; std::cout << "infinity_norm(B) is " << infinity_norm(B)<< "\n"; std::cout << "frobenius_norm(B) is " << frobenius_norm(B)<< "\n"; return 0; }
Hessian matrices are scaled by a factor, i.e. matrix::hessian_setup(A, alpha) is:
The funciton is intended for dense matrices. It works on sparse matrices but it is very expensive for large matrices.
The Laplacian setup matrix::laplacian(A, m, n) initializes a matrices with the same values as a finite difference method for a Laplace (Poisson) equation on an grid. The matrix size is changed to
. After the setup the diagonal is 4 and four off-diagonals are mostly set to -1, i.e. a simple five-point-stencil. It is intended for sparse matrices but also works on dense ones.
Return to Rank-One and Rank-Two Update Table of Content Proceed to Triangular Solvers
Other Matrix Functions -- 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.