3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-27 06:43:40 +01:00
dft_tools/test/triqs/arrays/lapack_on_view.cpp
Olivier Parcollet f2c7d449cc First commit : triqs libs version 1.0 alpha1
for earlier commits, see TRIQS0.x repository.
2013-07-17 19:24:07 +02:00

26 lines
727 B
C++

#include "./common.hpp"
#include "./src/array.hpp"
#include "./src/matrix.hpp"
#include "./src/linalg/matmul.hpp"
#include <iostream>
#include <triqs/arrays/asserts.hpp>
using std::cout; using std::endl;
using namespace triqs::arrays;
using namespace triqs::arrays;
// to be extended to more complex case
// calling lapack on view to test cache securities....
//
int main() {
array<std::complex<double>,3> TMPALL (2,2,5); TMPALL()=-1;
matrix_view<std::complex<double> > TMP ( TMPALL (range(), range(), 2));
matrix<std::complex<double> > M1(2,2), Res(2,2);
M1()=0; M1(0,0) = 2; M1(1,1) = 3.2;
Res()=0; Res(0,0) = 8; Res(1,1) = 16.64;
TMP() =0;
TMP() = M1*( M1 + 2.0 );
assert_all_close(TMP(), Res, 1.e-10);
}