@@ -314,14 +314,18 @@ maxspace(a::TensorSpace{<:NTuple{2,Space}}, b::TensorSpace{<:NTuple{2,Space}}) =
314
314
maxspace (a. spaces[1 ],b. spaces[1 ]) ⊗ maxspace (a. spaces[2 ],b. spaces[2 ])
315
315
316
316
function spacescompatible (A:: TensorSpace{<:NTuple{N,Space}} , B:: TensorSpace{<:NTuple{N,Space}} ) where {N}
317
- all (((a,b),) -> spacescompatible (a,b), zip (factors (A), factors (B)))
317
+ _spacescompatible (factors (A), factors (B))
318
+ end
319
+ _spacescompatible (:: Tuple{} , :: Tuple{} ) = true
320
+ function _spacescompatible (A:: Tuple{Space, Vararg{Space}} , B:: Tuple{Space, Vararg{Space}} )
321
+ spacescompatible (A[1 ], B[1 ]) && _spacescompatible (Base. tail (A), Base. tail (B))
318
322
end
319
323
320
324
canonicalspace (T:: TensorSpace ) = TensorSpace (map (canonicalspace,T. spaces))
321
325
322
326
323
327
TensorSpace (A:: SVector{N,<:Space} ) where N = TensorSpace (tuple (A... ))
324
- TensorSpace (A... ) = TensorSpace (tuple (A ... ) )
328
+ TensorSpace (A... ) = TensorSpace (A )
325
329
TensorSpace (A:: ProductDomain ) = TensorSpace (tuple (map (Space,components (A))... ))
326
330
⊗ (A:: TensorSpace ,B:: TensorSpace ) = TensorSpace (A. spaces... ,B. spaces... )
327
331
⊗ (A:: TensorSpace ,B:: Space ) = TensorSpace (A. spaces... ,B)
@@ -333,7 +337,7 @@ Space(sp::ProductDomain) = TensorSpace(sp)
333
337
334
338
setdomain (sp:: TensorSpace , d:: ProductDomain ) = TensorSpace (setdomain .(factors (sp), factors (d)))
335
339
336
- * (A:: Space , B:: Space ) = A⊗ B
340
+ * (A:: Space , B:: Space ) = A ⊗ B
337
341
function ^ (A:: Space , p:: Integer )
338
342
p >= 1 || throw (ArgumentError (" exponent must be >= 1, received $p " ))
339
343
# Enumerate common cases to help with constant propagation
0 commit comments