Skip to content

Commit 06ce735

Browse files
committed
slightly better examples
1 parent 5f5c5a9 commit 06ce735

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

example/intrinsics/example_matmul.f90

+15-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
program example_matmul
22
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
58

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)
719
end program example_matmul

0 commit comments

Comments
 (0)