You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to implement sqrt for pure scalar multivectors (so for Basis{V, 0, 0}, MValue{V, 0, v, T} and SValue{V, 0, v, T}), but I have a hard time to find the right syntax for the methods type declaration. It is easy for Basis:
sqrt(t::Basis{B, 0, 0x0000000000000000}) where {B} = 1
But I'm not sure how to define the type of MValue and SValue for scalar basis v. I can get v into the scope and write
julia> basis"2"
(⟨++⟩, v, v₁, v₂, v₁₂)
julia> sqrt(x::SValue{B, 0, v, T}) where {B, T} = sqrt(x.v)
sqrt (generic function with 23 methods)
julia> sqrt(13*v)
3.605551275463989
but that seems ugly and does not make sure that v matches the scalar basis for any B.
I guess I have to use the function indexbasis but I'm not sure about its syntax.
So this is more like a question than an actual issue (except maybe a documentation issue).
Btw: What is the difference between SValue and MValue?
PS: I hope that its clear, but I'm saying it anyway: I really like this package, thanks for all the work you are putting into it.
The text was updated successfully, but these errors were encountered:
More generally, you can define this method for Basis,SValue,MValue simultaneously with TensorTerm
Base.sqrt(x::T) where T<:TensorTerm{V,0}where V =sqrt(value(x))*basis(x)
since TensorTerm has Basis,SValue,MValue as a subtypes
julia>subtypes(TensorTerm{ℝ^2,0})
3-element Array{Any,1}:
Basis{⟨++⟩,0,B} where B
MValue{⟨++⟩,0,B,T} where T where B
SValue{⟨++⟩,0,B,T} where T where B
I'm trying to implement
sqrt
for pure scalar multivectors (so forBasis{V, 0, 0}
,MValue{V, 0, v, T}
andSValue{V, 0, v, T}
), but I have a hard time to find the right syntax for the methods type declaration. It is easy forBasis
:But I'm not sure how to define the type of
MValue
andSValue
for scalar basisv
. I can getv
into the scope and writebut that seems ugly and does not make sure that
v
matches the scalar basis for anyB
.I guess I have to use the function
indexbasis
but I'm not sure about its syntax.So this is more like a question than an actual issue (except maybe a documentation issue).
Btw: What is the difference between SValue and MValue?
PS: I hope that its clear, but I'm saying it anyway: I really like this package, thanks for all the work you are putting into it.
The text was updated successfully, but these errors were encountered: