Skip to content

Commit 76bcb4f

Browse files
committed
various minor algebra improvements
1 parent 7149875 commit 76bcb4f

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "DirectSum"
22
uuid = "22fd7b30-a8c0-5bf2-aabe-97783860d07c"
33
authors = ["Michael Reed"]
4-
version = "0.7.5"
4+
version = "0.7.6"
55

66
[deps]
77
ComputedFieldTypes = "459fdd68-db75-56b8-8c15-d717a790f88e"

src/DirectSum.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ for t ∈ (Any,Integer)
223223
@eval @inline function getindex(::SubManifold{M,N,S} where N,i::T) where {T<:$t,M,S}
224224
if typeof(M)<:SubManifold
225225
d = one(UInt) << (i-1)
226-
return (d & UInt(b)) == d
226+
return (d & UInt(M)) == d
227227
elseif typeof(M)<:Int
228228
1
229229
else
@@ -392,8 +392,8 @@ Base.:(==)(a::TensorTerm{V,G},b::TensorTerm{V,G}) where {V,G} = basis(a) == basi
392392

393393
for T (Fields...,Symbol,Expr)
394394
@eval begin
395-
Base.isapprox(a::S,b::T) where {S<:TensorAlgebra,T<:$T} = Base.isapprox(a,Simplex{Manifold(a)}(b))
396-
Base.isapprox(a::S,b::T) where {S<:$T,T<:TensorAlgebra} = Base.isapprox(b,a)
395+
Base.isapprox(a::S,b::T;atol::Real=0,rtol::Real=Base.rtoldefault(a,b,atol),nans::Bool=false,norm::Function=LinearAlgebra.norm) where {S<:TensorAlgebra,T<:$T} = Base.isapprox(a,Simplex{Manifold(a)}(b);atol=atol,rtol=rtol,nans=nans,norm=norm)
396+
Base.isapprox(a::S,b::T;atol::Real=0,rtol::Real=Base.rtoldefault(a,b,atol),nans::Bool=false,norm::Function=LinearAlgebra.norm) where {S<:$T,T<:TensorAlgebra} = Base.isapprox(b,a;atol=atol,rtol=rtol,nans=nans,norm=norm)
397397
end
398398
end
399399

src/generic.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export valuetype, value, hasinf, hasorigin, isorigin, norm, indices, tangent, is
2222

2323
#@pure Base.ndims(S::SubManifold{M,G}) where {G,M} = isbasis(S) ? mdims(M) : G
2424
@pure AbstractTensors.mdims(S::SubManifold{M,G}) where {G,M} = isbasis(S) ? mdims(M) : G
25-
@pure order(m::SubManifold{V,G,B} where G) where {V,B} = count_ones(symmetricmask(V,B,B)[4])
25+
@pure order(m::SubManifold{V,G,B} where G) where {V,B} = order(V)>0 ? count_ones(symmetricmask(V,B,B)[4]) : 0
2626
@pure order(m::Simplex) = order(basis(m))+order(value(m))
2727
@pure options(::T) where T<:TensorBundle{N,M} where N where M = M
2828
@pure options_list(V::M) where M<:Manifold = hasinf(V),hasorigin(V),dyadmode(V),polymode(V)

src/operations.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ for side ∈ (:left,:right)
324324
v = $(ch ? :($pn(V,B,value(d))) : :(value(d)))
325325
typeof(V)<:Signature ? ($p(b) ? Simplex{V}(-v,d) : isone(v) ? d : Simplex{V}(v,d)) : Simplex{V}($p(b)*v,d)
326326
end
327-
$c(b::Simplex) = value(b)0 ? value(b)*$c(basis(b)) : g_zero(Manifold(b))
327+
$c(b::Simplex) = value(b)0 ? conj(value(b))*$c(basis(b)) : g_zero(Manifold(b))
328328
end
329329
end
330330
end

0 commit comments

Comments
 (0)