-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'fortran-lang:master' into sparse
- Loading branch information
Showing
9 changed files
with
496 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
! Cholesky factorization: function interface | ||
program example_chol | ||
use stdlib_linalg, only: chol | ||
implicit none | ||
|
||
real, allocatable, dimension(:,:) :: A,L,U | ||
|
||
! Set real matrix | ||
A = reshape( [ [6, 15, 55], & | ||
[15, 55, 225], & | ||
[55, 225, 979] ], [3,3] ) | ||
|
||
! Decompose (lower) | ||
L = chol(A, lower=.true.) | ||
|
||
! Compare decomposition | ||
print *, maxval(abs(A-matmul(L,transpose(L)))) | ||
|
||
! Decompose (upper) | ||
U = chol(A, lower=.false.) | ||
|
||
! Compare decomposition | ||
print *, maxval(abs(A-matmul(transpose(U),U))) | ||
|
||
end program example_chol |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
! Cholesky factorization: subroutine interface | ||
program example_cholesky | ||
use stdlib_linalg, only: cholesky | ||
implicit none | ||
|
||
real, dimension(3,3) :: A,L,U | ||
|
||
! Set real matrix | ||
A = reshape( [ [6, 15, 55], & | ||
[15, 55, 225], & | ||
[55, 225, 979] ], [3,3] ) | ||
|
||
! Decompose (lower) | ||
call cholesky(A, L, lower=.true.) | ||
|
||
! Compare decomposition | ||
print *, maxval(abs(A-matmul(L,transpose(L)))) | ||
|
||
! Decompose (upper) | ||
call cholesky(A, U, lower=.false.) | ||
|
||
! Compare decomposition | ||
print *, maxval(abs(A-matmul(transpose(U),U))) | ||
|
||
end program example_cholesky |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.