-
Notifications
You must be signed in to change notification settings - Fork 191
linalg: Matrix norms #885
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
linalg: Matrix norms #885
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
5532ded
interpret `*LANGE` inputs
perazz 7b3b140
introduce internal implementation
perazz c2beec8
introduce module interface
perazz e3c85bf
fix `reshape` permutation index
perazz d4d1e85
docs: add interface explanation
perazz 48de116
add specs
perazz 04a61b7
add example
perazz 16657df
fix `use`
perazz 53de5e6
first test program
perazz 8323e14
first test program
perazz 3f30ed8
fix return size
perazz ded77dc
Merge branch 'matrix_norma' of https://github.com/perazz/stdlib into …
perazz 5d49645
Update test_linalg_mnorm.fypp
perazz ba59694
add generic-rank tests
perazz 8b98031
better example
perazz 753e31b
sync task with NumPy: no order-2, default=Frobenius
perazz a47f478
replace `LANGE_*` with `MAT_*`, add `max(svdvals(a))` option
perazz 106bf23
implement 2-norm `maxval(svdvals(a))`
perazz a2dd310
add 2-norm to the tests
perazz 89f2fa4
test flipped dimensions e.g. [2,1]
perazz 65d06f7
align specs table
perazz 706ea1c
Update doc/specs/stdlib_linalg.md
perazz f7ec7da
Update doc/specs/stdlib_linalg.md
perazz f52d57a
Update src/stdlib_linalg.fypp
perazz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,26 @@ | ||
program example_mnorm | ||
use stdlib_linalg, only: mnorm | ||
use stdlib_kinds, only: sp | ||
implicit none | ||
real(sp) :: a(3,3), na | ||
real(sp) :: b(3,3,4), nb(4) ! Array of 4 3x3 matrices | ||
|
||
! Initialize example matrix | ||
a = reshape([1, 2, 3, 4, 5, 6, 7, 8, 9], [3, 3]) | ||
|
||
! Compute Euclidean norm of single matrix | ||
na = mnorm(a, 'Euclidean') | ||
print *, "Euclidean norm of matrix a:", na | ||
|
||
! Initialize array of matrices | ||
b(:,:,1) = a | ||
b(:,:,2) = 2*a | ||
b(:,:,3) = 3*a | ||
b(:,:,4) = 4*a | ||
|
||
! Compute infinity norm of each 3x3 matrix in b | ||
nb = mnorm(b, 'inf', dim=[1,2]) | ||
|
||
! 18.0000000 36.0000000 54.0000000 72.0000000 | ||
print *, "Infinity norms of matrices in b:", nb | ||
end program example_mnorm |
This file contains hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.