Skip to content

Commit

Permalink
Use eigen functions in StaticArrays.jl (#211)
Browse files Browse the repository at this point in the history
* Use eigen functions in StaticArrays.jl

* Set version to 0.15.0
  • Loading branch information
KeitaNakamura authored Aug 31, 2024
1 parent a530364 commit 7ca98fb
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 186 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Tensorial"
uuid = "98f94333-fa9f-48a9-ad80-1c66397b2b38"
authors = ["Keita Nakamura <[email protected]>"]
version = "0.14.1"
version = "0.15.0"

[deps]
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
Expand Down
1 change: 0 additions & 1 deletion src/Tensorial.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ include("permute.jl")
include("ops.jl")
include("continuum_mechanics.jl")
include("inv.jl")
include("eigen.jl")
include("voigt.jl")
include("ad.jl")
# include("simd.jl")
Expand Down
97 changes: 0 additions & 97 deletions src/eigen.jl

This file was deleted.

10 changes: 10 additions & 0 deletions src/ops.jl
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,16 @@ for pv in (:true, :false)
end
lu(A::AbstractMat; check = true) = lu(A, Val(true); check = check)

# eigen
@inline function eigvals(x::AbstractSymmetricSecondOrderTensor; permute::Bool=true, scale::Bool=true)
Tensor(eigvals(Symmetric(SArray(x)); permute=permute, scale = scale))
end

@inline function eigen(x::AbstractSymmetricSecondOrderTensor; permute::Bool=true, scale::Bool=true)
eig = eigen(Symmetric(SArray(x)); permute=permute, scale=scale)
Eigen(Tensor(eig.values), Tensor(eig.vectors))
end

# svd
struct SVD{T, TU, TS, TVt} <: Factorization{T}
U::TU
Expand Down
86 changes: 0 additions & 86 deletions test/eigen.jl

This file was deleted.

7 changes: 7 additions & 0 deletions test/ops.jl
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,13 @@ end
@test U == Fs.U
@test p == Fs.p
end
@testset "eigen" begin
Random.seed!(1234)
x = rand(SymmetricSecondOrderTensor{3})
@test (@inferred eigvals(x)) eigvals(Array(x))
@test (@inferred eigen(x)).values eigen(Array(x)).values
@test (@inferred eigen(x)).vectors (@inferred eigvecs(x))
end
@testset "svd" begin
Random.seed!(1234)
At = rand(Mat{3,3})
Expand Down
1 change: 0 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ include("einsum.jl")
include("ops.jl")
include("continuum_mechanics.jl")
include("inv.jl")
include("eigen.jl")
include("voigt.jl")
include("ad.jl")
include("broadcast.jl")
Expand Down

2 comments on commit 7ca98fb

@KeitaNakamura
Copy link
Owner 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/114237

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

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 v0.15.0 -m "<description of version>" 7ca98fb94f6be02105ab49613a673092b1cf481b
git push origin v0.15.0

Please sign in to comment.