-
Notifications
You must be signed in to change notification settings - Fork 5
Add isisometry function and integrate into tests
#38
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
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d9a266f
Add `isisometry`
lkdvos c1e3ef2
Use `isisometry` in tests
lkdvos d646286
export function
lkdvos 423cb51
Bump v0.2.5
lkdvos e385514
Update interface based on discussions
lkdvos 1a86819
Update tests accordingly
lkdvos 7a5709f
Change `kind` to `side`
lkdvos 6810a42
Update src/common/matrixproperties.jl
lkdvos 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| name = "MatrixAlgebraKit" | ||
| uuid = "6c742aac-3347-4629-af66-fc926824e5e4" | ||
| authors = ["Jutho <[email protected]> and contributors"] | ||
| version = "0.2.4" | ||
| version = "0.2.5" | ||
|
|
||
| [deps] | ||
| LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" | ||
|
|
||
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,59 @@ | ||
| """ | ||
| isisometry(A; side=:left, isapprox_kwargs...) -> Bool | ||
|
|
||
| Test whether a linear map is an isometry, where the type of isometry is controlled by `kind`: | ||
|
|
||
| - `side = :left` : `A' * A ≈ I`. | ||
| - `side = :right` : `A * A` ≈ I`. | ||
|
|
||
| The `isapprox_kwargs` are passed on to `isapprox` to control the tolerances. | ||
|
|
||
| New specializations should overload [`is_left_isometry`](@ref) and [`is_right_isometry`](@ref). | ||
|
|
||
| See also [`isunitary`](@ref). | ||
| """ | ||
| function isisometry(A; side::Symbol=:left, isapprox_kwargs...) | ||
| side === :left && return is_left_isometry(A; isapprox_kwargs...) | ||
| side === :right && return is_right_isometry(A; isapprox_kwargs...) | ||
|
|
||
| throw(ArgumentError(lazy"Invalid isometry side: $side")) | ||
| end | ||
|
|
||
| """ | ||
| isunitary(A; isapprox_kwargs...) | ||
|
|
||
| Test whether a linear map is unitary, i.e. `A * A' ≈ I ≈ A' * A`. | ||
| The `isapprox_kwargs` are passed on to `isapprox` to control the tolerances. | ||
|
|
||
| See also [`isisometry`](@ref). | ||
| """ | ||
| function isunitary(A; isapprox_kwargs...) | ||
| return is_left_isometry(A; isapprox_kwargs...) && | ||
| is_right_isometry(A; isapprox_kwargs...) | ||
| end | ||
|
|
||
| @doc """ | ||
| is_left_isometry(A; isapprox_kwargs...) -> Bool | ||
|
|
||
| Test whether a linear map is a left isometry, i.e. `A' * A ≈ I`. | ||
| The `isapprox_kwargs` can be used to control the tolerances of the equality. | ||
|
|
||
| See also [`isisometry`](@ref) and [`is_right_isometry`](@ref). | ||
| """ is_left_isometry | ||
|
|
||
| function is_left_isometry(A::AbstractMatrix; isapprox_kwargs...) | ||
| return isapprox(A' * A, LinearAlgebra.I; isapprox_kwargs...) | ||
| end | ||
|
|
||
| @doc """ | ||
| is_right_isometry(A; isapprox_kwargs...) -> Bool | ||
|
|
||
| Test whether a linear map is a right isometry, i.e. `A * A' ≈ I`. | ||
| The `isapprox_kwargs` can be used to control the tolerances of the equality. | ||
|
|
||
| See also [`isisometry`](@ref) and [`is_left_isometry`](@ref). | ||
| """ is_right_isometry | ||
|
|
||
| function is_right_isometry(A::AbstractMatrix; isapprox_kwargs...) | ||
| return isapprox(A * A', LinearAlgebra.I; isapprox_kwargs...) | ||
| end | ||
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.
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.