|
1 | 1 | program example_matmul |
2 | 2 | use stdlib_intrinsics, only: stdlib_matmul |
3 | | - complex :: x(2, 2), y(2, 2) |
4 | | - real :: r1(50, 100), r2(100, 40), r3(40, 50) |
5 | | - real, allocatable :: res(:, :) |
| 3 | + complex :: x(2, 2), y(2, 2), z(2, 2) |
6 | 4 | x = reshape([(0, 0), (1, 0), (1, 0), (0, 0)], [2, 2]) |
7 | 5 | y = reshape([(0, 0), (0, 1), (0, -1), (0, 0)], [2, 2]) ! pauli y-matrix |
| 6 | + z = reshape([(1, 0), (0, 0), (0, 0), (-1, 0)], [2, 2]) |
8 | 7 |
|
9 | | - print *, stdlib_matmul(y, y, y) ! should be y |
10 | | - print *, stdlib_matmul(x, x, y, x) ! should be -i x sigma_z |
11 | | - |
12 | | - call random_seed() |
13 | | - call random_number(r1) |
14 | | - call random_number(r2) |
15 | | - call random_number(r3) |
16 | | - |
17 | | - res = stdlib_matmul(r1, r2, r3) ! 50x50 matrix |
18 | | - print *, shape(res) |
| 8 | + print *, stdlib_matmul(x, y) ! should be iota*z |
| 9 | + print *, stdlib_matmul(y, z, x) ! should be iota*identity |
| 10 | + print *, stdlib_matmul(x, x, z, y) ! should be -iota*x |
| 11 | + print *, stdlib_matmul(x, x, z, y, y) ! should be z |
19 | 12 | end program example_matmul |
0 commit comments