Skip to content

Commit 45a606f

Browse files
committed
add det example
1 parent 15023e1 commit 45a606f

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

example/linalg/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ ADD_EXAMPLE(state1)
1818
ADD_EXAMPLE(state2)
1919
ADD_EXAMPLE(blas_gemv)
2020
ADD_EXAMPLE(lapack_getrf)
21+
ADD_EXAMPLE(determinant)
22+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
program example_determinant
2+
use stdlib_kinds, only: dp
3+
use stdlib_linalg, only: det, linalg_state_type
4+
implicit none
5+
type(linalg_state_type) :: err
6+
7+
real(dp) :: d
8+
9+
! Compute determinate of a real matrix
10+
d = det(reshape([real(dp)::1,2,3,4],[2,2]))
11+
12+
print *, d ! a*d-b*c = -2.0
13+
14+
end program example_determinant

0 commit comments

Comments
 (0)