Skip to content

Commit

Permalink
extended Real, Complex for TensorField
Browse files Browse the repository at this point in the history
  • Loading branch information
chakravala committed Aug 13, 2023
1 parent e5ea50e commit 9462453
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "TensorFields"
uuid = "86e2b4fd-d9c8-44dc-a03f-e0a387f3b4e6"
authors = ["Michael Reed"]
version = "0.1.2"
version = "0.1.3"

[deps]
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
Expand Down
10 changes: 8 additions & 2 deletions src/TensorFields.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export initmesh, pdegrad

export ElementFunction, IntervalMap, PlaneCurve, SpaceCurve, SurfaceGrid, ScalarGrid
export TensorField, ScalarField, VectorField, BivectorField, TrivectorField
export RealFunction, ComplexMap, ComplexMapping, SpinorField, CliffordField
export RealFunction, ComplexMap, SpinorField, CliffordField
export MeshFunction, GradedField, QuaternionField # PhasorField
export Section, FiberBundle, AbstractFiber
export base, fiber, domain, codomain, , , , , basetype, fibertype
Expand Down Expand Up @@ -153,6 +153,9 @@ 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))
(V::Submanifold)(s::Section) = base(a) V(fiber(s))
(::Type{T})(s::Section) where T<:Real = base(s) T(fiber(s))
(::Type{Complex})(s::Section) = base(s) Complex(fiber(s))
(::Type{Complex{T}})(s::Section) where T = base(s) Complex{T}(fiber(s))

# FiberBundle

Expand Down Expand Up @@ -302,10 +305,13 @@ for fun ∈ (:reverse,:involute,:clifford,:even,:odd,:scalar,:vector,:bivector,:
@eval Grassmann.$fun(t::TensorField) = domain(t) $fun.(codomain(t))
end

Base.inv(t::TensorField) = fiber(t) base(t)
Base.inv(t::TensorField) = codomain(t) domain(t)
absvalue(t::TensorField) = domain(t) value.(abs.(codomain(t)))
LinearAlgebra.norm(t::TensorField) = domain(t) norm.(codomain(t))
(V::Submanifold)(t::TensorField) = domain(t) V.(codomain(t))
(::Type{T})(t::TensorField) where T<:Real = domain(t) T.(codomain(t))
(::Type{Complex})(t::TensorField) = domain(t) Complex.(codomain(t))
(::Type{Complex{T}})(t::TensorField) where T = domain(t) Complex{T}.(codomain(t))

checkdomain(a::TensorField,b::TensorField) = domain(a)domain(b) ? error("TensorField domains not equal") : true

Expand Down

0 comments on commit 9462453

Please sign in to comment.