MTL 4: Sub-matrices
#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; dense2D<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 << "sub_matrix(A, 2, 4, 1, 7) is\n" << with_format(sub_matrix(A, 2, 4, 1, 7), 7, 1) << "\n"; dense2D<cdouble> B= sub_matrix(A, 2, 4, 1, 7); B[1][2]= 88; std::cout << "A is\n" << with_format(A, 7, 1) << "\n"; return 0; }
Details on the copy behavior of sub-matrices can be found in section Copying Sub-matrices.
Return to Hermitian Table of Content Proceed to Permutations and Reordering
Sub-matrices -- MTL 4 -- Peter Gottschling and Andrew Lumsdaine
-- Generated on 24 Aug 2009 by Doxygen 1.5.9 -- Copyright 2008-09 by TU Dresden and the Trustees of Indiana University.