]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/numeric/ublas/doc/samples/hermitian_adaptor.cpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / numeric / ublas / doc / samples / hermitian_adaptor.cpp
CommitLineData
7c673cae
FG
1//
2// Copyright (c) 2000-2002
3// Joerg Walter, Mathias Koch
4//
5// Distributed under the Boost Software License, Version 1.0. (See
6// accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8//
9// The authors gratefully acknowledge the support of
10// GeNeSys mbH & Co. KG in producing this work.
11//
12
13#include <boost/numeric/ublas/hermitian.hpp>
14#include <boost/numeric/ublas/io.hpp>
15
16int main () {
17 using namespace boost::numeric::ublas;
18 matrix<std::complex<double> > m (3, 3);
19 hermitian_adaptor<matrix<std::complex<double> >, lower> hal (m);
20 for (unsigned i = 0; i < hal.size1 (); ++ i) {
21 for (unsigned j = 0; j < i; ++ j)
22 hal (i, j) = std::complex<double> (3 * i + j, 3 * i + j);
23 hal (i, i) = std::complex<double> (4 * i, 0);
24 }
25 std::cout << hal << std::endl;
26 hermitian_adaptor<matrix<std::complex<double> >, upper> hau (m);
27 for (unsigned i = 0; i < hau.size1 (); ++ i) {
28 hau (i, i) = std::complex<double> (4 * i, 0);
29 for (unsigned j = i + 1; j < hau.size2 (); ++ j)
30 hau (i, j) = std::complex<double> (3 * i + j, 3 * i + j);
31 }
32 std::cout << hau << std::endl;
33}
34