Skip to content

Commit

Permalink
deprecated AbstractTensors
Browse files Browse the repository at this point in the history
  • Loading branch information
chakravala committed Apr 23, 2024
1 parent 5564298 commit 2ea23b1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 35 deletions.
4 changes: 1 addition & 3 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ environment:
matrix:
- julia_version: 1
- julia_version: 1.6
- julia_version: 1.7
- julia_version: 1.8
- julia_version: 1.9
- julia_version: 1.10
- julia_version: nightly

platform:
Expand Down
6 changes: 1 addition & 5 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
name = "TensorFields"
uuid = "86e2b4fd-d9c8-44dc-a03f-e0a387f3b4e6"
authors = ["Michael Reed"]
version = "0.1.4"
version = "0.1.5"

[deps]
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
DirectSum = "22fd7b30-a8c0-5bf2-aabe-97783860d07c"
Grassmann = "4df31cd9-4c27-5bea-88d0-e6a7146666d8"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
AbstractTensors = "a8e43f4a-99b7-5565-8bf1-0165161caaea"

[compat]
julia = "1"
Requires = "1"
AbstractTensors = "0.7"
DirectSum = "0.8"
Grassmann = "0.8"

[extras]
Expand Down
46 changes: 19 additions & 27 deletions src/TensorFields.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ module TensorFields
# / / | __/ | | \__ \ (_) | | / / | | __/ | (_| \__ \
# \/ \___|_| |_|___/\___/|_| \/ |_|\___|_|\__,_|___/

using SparseArrays, LinearAlgebra, Base.Threads
using AbstractTensors, DirectSum, Grassmann, Requires
import Grassmann: value, vector, valuetype, tangent, Derivation, radius
using SparseArrays, LinearAlgebra, Base.Threads, Grassmann, Requires
import Grassmann: value, vector, valuetype, tangent, Derivation, radius,
import Grassmann: Values, Variables, FixedVector
import Grassmann: Scalar, GradedVector, Bivector, Trivector
import Base: @pure, OneTo
import AbstractTensors: Values, Variables, FixedVector
import AbstractTensors: Scalar, GradedVector, Bivector, Trivector
import DirectSum:

export Values, Derivation
export initmesh, pdegrad, det
Expand Down Expand Up @@ -153,18 +151,18 @@ end
for fun (:reverse,:involute,:clifford,:even,:odd,:scalar,:vector,:bivector,:volume,:value,:curl,:∂,:d,:,:angle,:radius)
@eval Grassmann.$fun(s::Section) = base(s) $fun(fiber(s))
end
for op (:+,:-,:*,:/,:<,:>,:<<,:>>,:&)
@eval Base.$op(a::Section{R},b::Section{R}) where R = base(a)==base(b) ? Section(base(a),$op(fiber(a),fiber(b))) : error("Section $(base(a))$(base(b))")
end
for op (:,:)
@eval Grassmann.$op(a::Section{R},b::Section{R}) where R = base(a)==base(b) ? Section(base(a),$op(fiber(a),fiber(b))) : error("Section $(base(a))$(base(b))")
for op (:+,:-,:*,:/,:^,:<,:>,:<<,:>>,:&,:,:)
let bop = op (:,:) ? :(Grassmann.$op) : :(Base.$op)
@eval begin
$bop(a::Section{R},b::Section{R}) where R = base(a)==base(b) ? Section(base(a),$op(fiber(a),fiber(b))) : error("Section $(base(a))$(base(b))")
$bop(a::Number,b::Section) = base(b) $op(a,fiber(b))
$bop(a::Section,b::Number) = base(a) $op(fiber(a),b)
end
end
end

Grassmann.contraction(a::Section{R},b::Section{R}) where R = base(a)==base(b) ? Section(base(a),Grassmann.contraction(fiber(a),fiber(b))) : error("Section $(base(a))$(base(b))")

Base.:*(a::Number,b::Section) = base(b) (a*fiber(b))
Base.:*(a::Section,b::Number) = base(a) (fiber(a)*b)
Base.:/(a::Section,b::Number) = base(a) (fiber(a)/b)
LinearAlgebra.norm(s::Section) = base(s) norm(fiber(s))
LinearAlgebra.det(s::Section) = base(s) det(fiber(s))
(V::Submanifold)(s::Section) = base(a) V(fiber(s))
Expand Down Expand Up @@ -346,19 +344,13 @@ function Grassmann.Chain(t::TensorField{B,T,<:Chain{V,G}} where {B,T}) where {V,
Chain{V,G}((base(t) getindex.(fiber(t),j) for j 1:binomial(mdims(V),G))...)
end
Base.:^(t::TensorField,n::Int) = domain(t) codomain(t).^n
Base.:^(t::TensorField,n::Number) = domain(t) codomain(t).^n
for op (:*,:/,:+,:-,:>,:<,:>>,:<<,:&)
@eval begin
Base.$op(a::TensorField,b::TensorField) = checkdomain(a,b) && (domain(a) $op.(codomain(a),codomain(b)))
Base.$op(a::TensorField,b::Number) = domain(a) $op.(codomain(a),Ref(b))
Base.$op(a::Number,b::TensorField) = domain(b) $op.(Ref(a),codomain(b))
end
end
for op (:,:,:)
@eval begin
Grassmann.$op(a::TensorField,b::TensorField) = checkdomain(a,b) && (domain(a) $op.(codomain(a),codomain(b)))
Grassmann.$op(a::TensorField,b::Number) = domain(a) $op.(codomain(a),Ref(b))
Grassmann.$op(a::Number,b::TensorField) = domain(b) $op.(Ref(a),codomain(b))
for op (:*,:/,:+,:-,:^,:>,:<,:>>,:<<,:&,:,:,:)
let bop = op (:,:,:) ? :(Grassmann.$op) : :(Base.$op)
@eval begin
$bop(a::TensorField,b::TensorField) = checkdomain(a,b) && (domain(a) $op.(codomain(a),codomain(b)))
$bop(a::TensorField,b::Number) = domain(a) $op.(codomain(a),Ref(b))
$bop(a::Number,b::TensorField) = domain(b) $op.(Ref(a),codomain(b))
end
end
end
for fun (:-,:!,:~,:exp,:log,:sinh,:cosh,:abs,:sqrt,:real,:imag,:cos,:sin,:tan,:cot,:sec,:csc,:asec,:acsc,:sech,:csch,:asech,:tanh,:coth,:asinh,:acosh,:atanh,:acoth,:asin,:acos,:atan,:acot,:sinc,:cosc,:abs2,:conj)
Expand Down

2 comments on commit 2ea23b1

@chakravala
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 register()

@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/105486

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.1.5 -m "<description of version>" 2ea23b1e1a3182abd48a5be361b46271062a372b
git push origin v0.1.5

Please sign in to comment.