Skip to content

Commit

Permalink
fixed some syntax errors
Browse files Browse the repository at this point in the history
  • Loading branch information
chakravala committed Oct 2, 2024
1 parent 4d9a53d commit d79513c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Grassmann"
uuid = "4df31cd9-4c27-5bea-88d0-e6a7146666d8"
authors = ["Michael Reed"]
version = "0.8.23"
version = "0.8.24"

[deps]
AbstractTensors = "a8e43f4a-99b7-5565-8bf1-0165161caaea"
Expand Down
44 changes: 22 additions & 22 deletions src/algebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -763,10 +763,10 @@ adder(a,b,op=:+) = adder(typeof(a),typeof(b),op)
elseif L == G
if binomial(mdims(V),G)<(1<<cache_limit)
$(insert_expr((:N,:ib,:t),:mvec)...)
out = svec(N,G,Any)(zeros(svec(N,G,t)))
out = svec(N,G,Any)(zeros(svec(N,G,t<:Number ? t : Int)))
setblade!_pre(out,:(value(a,$t)),UInt(basis(a)),Val{N}())
setblade!_pre(out,:($bop(value(b,$t))),UInt(basis(b)),Val{N}())
return :(Chain{V,L}($(Expr(:call,tvec(N,G,t),out...))))
return :(Chain{V,L}($(Expr(:call,tvec(N,G,t<:Number ? t : Any),out...))))
else return quote
$(insert_expr((:N,:t))...)
out = zeros($VEC(N,L,t))
Expand All @@ -787,10 +787,10 @@ adder(a,b,op=:+) = adder(typeof(a),typeof(b),op)
left,bop,VEC = addvec(a,b,false,op)
if mdims(V)-1<cache_limit
$(insert_expr((:N,:t),:mvecs)...)
out,ib = svecs(N,Any)(zeros(svecs(N,t))),indexbasis(N)
out,ib = svecs(N,Any)(zeros(svecs(N,t<:Number ? t : Int))),indexbasis(N)
setspin!_pre(out,:(value(a,$t)),UInt(basis(a)),Val{N}())
setspin!_pre(out,:($bop(value(b,$t))),UInt(basis(b)),Val{N}())
return :(Spinor{V}($(Expr(:call,tvecs(N,t),out...))))
return :(Spinor{V}($(Expr(:call,tvecs(N,t<:Number ? t : Any),out...))))
else quote
$(insert_expr((:N,:t),VEC)...)
out = zeros(mvecs(N,t))
Expand All @@ -805,10 +805,10 @@ adder(a,b,op=:+) = adder(typeof(a),typeof(b),op)
if mdims(V)-1<cache_limit
$(insert_expr((:N,),:svecs)...)
t = promote_type(valuetype(a),valuetype(b))
out,ib = svecs(N,Any)(zeros(svecs(N,t))),indexbasis(N)
out,ib = svecs(N,Any)(zeros(svecs(N,t<:Number ? t : Int))),indexbasis(N)
setanti!_pre(out,:(value(a,$t)),UInt(basis(a)),Val{N}())
setanti!_pre(out,:($bop(value(b,$t))),UInt(basis(b)),Val{N}())
return :(AntiSpinor{V}($(Expr(:call,tvecs(N,t),out...))))
return :(AntiSpinor{V}($(Expr(:call,tvecs(N,t<:Number ? t : Any),out...))))
else quote
$(insert_expr((:N,:t),VEC)...)
out = zeros(mvecs(N,t))
Expand All @@ -821,10 +821,10 @@ adder(a,b,op=:+) = adder(typeof(a),typeof(b),op)
left,bop,VEC = addvec(a,b,false,op)
if mdims(V)<cache_limit
$(insert_expr((:N,:t),:mvec)...)
out,ib = svec(N,Any)(zeros(svec(N,t))),indexbasis(N)
out,ib = svec(N,Any)(zeros(svec(N,t<:Number ? t : Int))),indexbasis(N)
setmulti!_pre(out,:(value(a,$t)),UInt(basis(a)),Val{N}())
setmulti!_pre(out,:($bop(value(b,$t))),UInt(basis(b)),Val{N}())
return :(Multivector{V}($(Expr(:call,tvec(N,t),out...))))
return :(Multivector{V}($(Expr(:call,tvec(N,t<:Number ? t : Any),out...))))
else quote
$(insert_expr((:N,:t,:out),VEC)...)
setmulti!(out,value(a,t),UInt(basis(a)),Val{N}())
Expand All @@ -836,15 +836,15 @@ adder(a,b,op=:+) = adder(typeof(a),typeof(b),op)
left,right,VEC = addvec(a,b,swap,op)
if binomial(mdims(V),G)<(1<<cache_limit)
$(insert_expr((:N,:ib,:t),:mvec)...)
out = svec(N,G,Any)(zeros(svec(N,G,t)))
out = svec(N,G,Any)(zeros(svec(N,G,t<:Number ? t : Int)))
X = UInt(basis(a))
for k list(1,binomial(N,G))
B = @inbounds ib[k]
val = :(@inbounds $right(b.v[$k]))
val = B==X ? Expr(:call,left,val,:(value(a,$t))) : val
setblade!_pre(out,val,B,Val{N}())
end
return :(Chain{V,G}($(Expr(:call,tvec(N,G,t),out...))))
return :(Chain{V,G}($(Expr(:call,tvec(N,G,t<:Number ? t : Any),out...))))
else return if !swap; quote
$(insert_expr((:N,:t),VEC)...)
out = convert($VEC(N,G,t),$(bcast(right,:(value(b,$VEC(N,G,t)),))))
Expand Down Expand Up @@ -883,7 +883,7 @@ adder(a,b,op=:+) = adder(typeof(a),typeof(b),op)
elseif iseven(L) && iseven(G)
if mdims(V)-1<cache_limit
$(insert_expr((:N,:ib,:bn,:t),:mvecs)...)
out = svecs(N,Any)(zeros(svecs(N,t)))
out = svecs(N,Any)(zeros(svecs(N,t<:Number ? t : Int)))
X = UInt(basis(a))
for k list(1,binomial(N,G))
B = @inbounds ib[k]
Expand All @@ -893,7 +893,7 @@ adder(a,b,op=:+) = adder(typeof(a),typeof(b),op)
end
val = :(@inbounds $left(value(a,$t)))
setspin!_pre(out,val,X,Val(N))
return :(Spinor{V}($(Expr(:call,tvecs(N,t),out...))))
return :(Spinor{V}($(Expr(:call,tvecs(N,t<:Number ? t : Any),out...))))
else return if !swap; quote
$(insert_expr((:N,:t,:out,:rr,:bng),VECS)...)
@inbounds out[rr+1:rr+bng] = $(bcast(right,:(value(b,$VEC(N,G,t)),)))
Expand All @@ -908,7 +908,7 @@ adder(a,b,op=:+) = adder(typeof(a),typeof(b),op)
elseif isodd(L) && isodd(G)
if mdims(V)-1<cache_limit
$(insert_expr((:N,:ib,:bn,:t),:mvecs)...)
out = svecs(N,Any)(zeros(svecs(N,t)))
out = svecs(N,Any)(zeros(svecs(N,t<:Number ? t : Int)))
X = UInt(basis(a))
for k list(1,binomial(N,G))
B = @inbounds ib[k]
Expand All @@ -918,7 +918,7 @@ adder(a,b,op=:+) = adder(typeof(a),typeof(b),op)
end
val = :(@inbounds $left(value(a,$t)))
setanti!_pre(out,val,X,Val(N))
return :(AntiSpinor{V}($(Expr(:call,tvecs(N,t),out...))))
return :(AntiSpinor{V}($(Expr(:call,tvecs(N,t<:Number ? t : Any),out...))))
else return if !swap; quote
$(insert_expr((:N,:t,:out,:rrr,:bng),VECS)...)
@inbounds out[rrr+1:rrr+bng] = $(bcast(right,:(value(b,$VEC(N,G,t)),)))
Expand All @@ -933,7 +933,7 @@ adder(a,b,op=:+) = adder(typeof(a),typeof(b),op)
else
if mdims(V)<cache_limit
$(insert_expr((:N,:ib,:bn,:t),:mvec)...)
out = svec(N,Any)(zeros(svec(N,t)))
out = svec(N,Any)(zeros(svec(N,t<:Number ? t : Int)))
X = UInt(basis(a))
for k list(1,binomial(N,G))
B = @inbounds ib[k]
Expand All @@ -943,7 +943,7 @@ adder(a,b,op=:+) = adder(typeof(a),typeof(b),op)
end
val = :(@inbounds $left(value(a,$t)))
setmulti!_pre(out,val,X,Val(N))
return :(Multivector{V}($(Expr(:call,tvec(N,t),out...))))
return :(Multivector{V}($(Expr(:call,tvec(N,t<:Number ? t : Any),out...))))
else return if !swap; quote
$(insert_expr((:N,:t,:out,:r,:bng),VEC)...)
@inbounds out[r+1:r+bng] = $(bcast(right,:(value(b,$VEC(N,G,t)),)))
Expand All @@ -961,7 +961,7 @@ adder(a,b,op=:+) = adder(typeof(a),typeof(b),op)
left,right,VEC = addvec(a,b,swap,op)
if mdims(V)<cache_limit
$(insert_expr((:N,:bs,:bn,:t),:mvec)...)
out = svec(N,Any)(zeros(svec(N,t)))
out = svec(N,Any)(zeros(svec(N,t<:Number ? t : Int)))
X = UInt(basis(a))
for g list(1,N+1)
ib = indexbasis(N,g-1)
Expand All @@ -972,7 +972,7 @@ adder(a,b,op=:+) = adder(typeof(a),typeof(b),op)
setmulti!_pre(out,val,B,Val(N))
end
end
return :(Multivector{V}($(Expr(:call,tvec(N,t),out...))))
return :(Multivector{V}($(Expr(:call,tvec(N,t<:Number ? t : Any),out...))))
else return if !swap; quote
$(insert_expr((:N,:t),VEC)...)
out = convert($VEC(N,t),$(bcast(right,:(value(b,$VEC(N,t)),))))
Expand All @@ -991,7 +991,7 @@ adder(a,b,op=:+) = adder(typeof(a),typeof(b),op)
!iseven(G) && (return swap ? :($op(Multivector(b),a)) : :($op(a,Multivector(b))))
if mdims(V)<cache_limit
$(insert_expr((:N,:rs,:bn,:t),:mvecs)...)
out = svecs(N,Any)(zeros(svecs(N,t)))
out = svecs(N,Any)(zeros(svecs(N,t<:Number ? t : Int)))
X = UInt(basis(a))
for g evens(1,N+1)
ib = indexbasis(N,g-1)
Expand All @@ -1002,7 +1002,7 @@ adder(a,b,op=:+) = adder(typeof(a),typeof(b),op)
setspin!_pre(out,val,B,Val(N))
end
end
return :(Spinor{V}($(Expr(:call,tvecs(N,t),out...))))
return :(Spinor{V}($(Expr(:call,tvecs(N,t<:Number ? t : Any),out...))))
else return if !swap; quote
$(insert_expr((:N,:t),VEC)...)
out = convert($VECS(N,t),$(bcast(right,:(value(b,$VECS(N,t)),))))
Expand All @@ -1021,7 +1021,7 @@ adder(a,b,op=:+) = adder(typeof(a),typeof(b),op)
!isodd(G) && (return swap ? :($op(Multivector(b),a)) : :($op(a,Multivector(b))))
if mdims(V)<cache_limit
$(insert_expr((:N,:ps,:bn,:t),:mvecs)...)
out = svecs(N,Any)(zeros(svecs(N,t)))
out = svecs(N,Any)(zeros(svecs(N,t<:Number ? t : Int)))
X = UInt(basis(a))
for g evens(2,N+1)
ib = indexbasis(N,g-1)
Expand All @@ -1032,7 +1032,7 @@ adder(a,b,op=:+) = adder(typeof(a),typeof(b),op)
setanti!_pre(out,val,B,Val(N))
end
end
return :(AntiSpinor{V}($(Expr(:call,tvecs(N,t),out...))))
return :(AntiSpinor{V}($(Expr(:call,tvecs(N,t<:Number ? t : Any),out...))))
else return if !swap; quote
$(insert_expr((:N,:t),VEC)...)
out = convert($VECS(N,t),$(bcast(right,:(value(b,$VECS(N,t)),))))
Expand Down
9 changes: 6 additions & 3 deletions src/parity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,13 @@ end
end

@pure parityregressive(V::Signature,a,b,skew=Val(false)) = _parityregressive(V,a,b,skew)
@pure function parityregressive(::M,A,B) where M<:Manifold{V} where V
p,C,t,Z = parityregressive(Signature(V),A,B)
@pure function parityregressivenum(V,A,B)
p,C,t,Z = _parityregressive(V,A,B)
return p ? -1 : 1, C, t, Z
end
@pure function parityregressive(::M,A,B) where M<:Manifold{V} where V
parityregressivenum(Signature(V),A,B)
end

@pure function parityinterior(V::Int,a,b)
A,B,Q,Z = symmetricmask(V,a,b)
Expand Down Expand Up @@ -364,7 +367,7 @@ function interior(V,a,b,c::Val{lim},d::Val{field}=Val(false)) where {lim,field}
end

for par (:conformal,:regressive,:interior)
calc = Symbol(:parity,par)
calc = par:regressive ? Symbol(:parity,par) : :parityregressivenum
T = Tuple{Any,UInt,Bool,UInt}
extra = Symbol(par,:_extra)
cache = Symbol(par,:_cache)
Expand Down

2 comments on commit d79513c

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

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

Please sign in to comment.