Skip to content

Commit

Permalink
implement eigX and Xdet (#207)
Browse files Browse the repository at this point in the history
  • Loading branch information
mzgubic authored Aug 22, 2022
1 parent b8b745c commit 5d66834
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "NamedDims"
uuid = "356022a1-0364-5f58-8944-0da4b18d706f"
authors = ["Invenia Technical Computing Corporation"]
version = "1.0.0"
version = "1.1.0"

[deps]
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"
Expand Down
5 changes: 4 additions & 1 deletion src/functions_linearalgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,7 @@ end
# Diagonal on a nameddim presently loses its nameddimsness. So just pass through for now.
LinearAlgebra.:\(A::Diagonal, B::NamedDimsArray) = LinearAlgebra.:\(A, parent(B))

LinearAlgebra.isposdef(A::NamedDimsArray) = isposdef(parent(A))
# eigenvectors and eigenvalues do not inherit dimension names
for f in [:isposdef, :eigen, :eigvals, :det, :logdet, :logabsdet]
@eval LinearAlgebra.$f(A::NamedDimsArray) = $f(parent(A))
end
11 changes: 11 additions & 0 deletions test/functions_linearalgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,17 @@ end
)
end

@testset "LinearAlgebra: eigen, det" begin
A = rand(4, 4)
corr = A * A'
nda = NamedDimsArray{(:a, :b)}(corr)
@test eigen(nda) == eigen(corr)
@test eigvals(nda) == eigvals(corr)
@test det(nda) == det(corr)
@test logdet(nda) == logdet(corr)
@test logabsdet(nda) == logabsdet(corr)
end

@testset "isposdef" begin
A = [1 2; 2 50]

Expand Down

2 comments on commit 5d66834

@mzgubic
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/66790

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.1.0 -m "<description of version>" 5d668346985ab93620485a3cfdfb2b1aca4e38c4
git push origin v1.1.0

Please sign in to comment.