We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7d8ca7d commit d594573Copy full SHA for d594573
example/linalg/example_schur_real.f90
@@ -3,16 +3,13 @@ program example_schur_real
3
use stdlib_linalg, only: schur
4
use stdlib_linalg_constants, only: dp
5
implicit none
6
- real(dp), allocatable :: A(:,:), T(:,:), Z(:,:)
7
- integer :: n
+ integer, parameter :: n = 3
+ real(dp), dimension(n,n) :: A, T, Z
8
9
! Initialize a real-valued square matrix
10
- n = 3
11
- allocate(A(n,n), T(n,n), Z(n,n))
12
- A = reshape([ &
13
- 0.0_dp, 2.0_dp, 2.0_dp, &
14
- 0.0_dp, 1.0_dp, 2.0_dp, &
15
- 1.0_dp, 0.0_dp, 1.0_dp], shape=[n,n])
+ A = reshape([ 0, 2, 2, &
+ 0, 1, 2, &
+ 1, 0, 1], shape=[n,n])
16
17
! Compute the Schur decomposition: A = Z T Z^T
18
call schur(A, T, Z)
@@ -28,6 +25,5 @@ program example_schur_real
28
25
! Test factorization: Z*T*Z^T = A
29
26
print *, "Max error in reconstruction:", maxval(abs(matmul(Z, matmul(T, transpose(Z))) - A))
30
27
31
- deallocate(A, T, Z)
32
end program example_schur_real
33
0 commit comments