|
1 | 1 | program example_matmul
|
2 | 2 | use stdlib_intrinsics, only: stdlib_matmul
|
3 |
| - complex :: a(2,2) |
4 |
| - a = reshape([(0, 0), (0, -1), (0, 1), (0, 0)], [2, 2]) ! pauli y-matrix |
| 3 | + complex :: x(2, 2), y(2, 2) |
| 4 | + real :: r1(50, 100), r2(100, 40), r3(40, 50) |
| 5 | + real, allocatable :: res(:, :) |
| 6 | + x = reshape([(0, 0), (1, 0), (1, 0), (0, 0)], [2, 2]) |
| 7 | + y = reshape([(0, 0), (0, -1), (0, 1), (0, 0)], [2, 2]) ! pauli y-matrix |
5 | 8 |
|
6 |
| - print *, stdlib_matmul(a, a, a, a, a) ! should be sigma_y |
| 9 | + print *, stdlib_matmul(y, y, 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) |
7 | 19 | end program example_matmul
|
0 commit comments