@@ -7,6 +7,10 @@ abstract type AbstractProductSpace{SV,DD,RR} <: Space{DD,RR} end
7
7
8
8
spacetype (:: AbstractProductSpace{SV} ,k) where {SV} = SV. parameters[k]
9
9
10
+ nfactors (d:: AbstractProductSpace ) = length (factors (d))
11
+ factors (d:: AbstractProductSpace ) = d. spaces
12
+ factor (d:: AbstractProductSpace ,k) = factors (d)[k]
13
+
10
14
11
15
# #### Tensorizer
12
16
# This gives the map from coefficients to the
@@ -401,37 +405,34 @@ iterate(sp::TensorSpace{Tuple{S1,S2}},k...) where {S1,S2<:Space{D,R}} where {D,R
401
405
# TODO : remove
402
406
columnspace (S:: TensorSpace ,_) = S. spaces[1 ]
403
407
408
+ isambiguous (A:: TensorSpace ) = any (isambiguous, A. spaces)
409
+
410
+ Base. transpose (d:: TensorSpace2D ) = TensorSpace (d. spaces[2 ],d. spaces[1 ])
411
+
404
412
405
413
struct ProductSpace{S<: Space ,V<: Space ,D,R} <: AbstractProductSpace{Tuple{S,V},D,R}
406
414
spacesx:: Vector{S}
407
415
spacey:: V
416
+ domain:: D
408
417
end
409
418
410
419
function ProductSpace (spacesx:: AbstractVector , spacey)
411
- ProductSpace{eltype (spacesx),typeof (spacey),typeof (mapreduce (domain, × , spacesx)),
412
- mapreduce (s-> eltype (domain (s)),promote_type,spacesx)}(spacesx,spacey)
420
+ dx = domain (spacesx[1 ])
421
+ @assert all (sp -> domain (sp) == dx, spacesx) " domains of component Funs must be identical"
422
+ dy = domain (spacey)
423
+ Tdx = mapreduce (s-> eltype (domain (s)),promote_type,spacesx)
424
+ Tdy = eltype (dy)
425
+ Td = promote_type (Tdx, Tdy)
426
+ d = convert (Domain{Td}, dx) × convert (Domain{Td}, dy)
427
+ ProductSpace {eltype(spacesx),typeof(spacey),typeof(d),Td} (spacesx, spacey, d)
413
428
end
414
429
415
430
# TODO : This is a weird definition
416
431
⊗ (A:: AbstractVector{S} ,B:: Space ) where {S<: Space } = ProductSpace (A,B)
417
- domain (f:: ProductSpace ) = domain (f . spacesx[ 1 ]) × domain (f . spacey)
432
+ domain (f:: ProductSpace ) = f . domain
418
433
419
434
factors (d:: ProductSpace ) = (d. spacesx, d. spacey)
420
435
421
- nfactors (d:: AbstractProductSpace ) = length (d. spaces)
422
- factors (d:: AbstractProductSpace ) = d. spaces
423
- factor (d:: AbstractProductSpace ,k) = factors (d)[k]
424
-
425
-
426
- isambiguous (A:: TensorSpace ) = isambiguous (A. spaces[1 ]) || isambiguous (A. spaces[2 ])
427
-
428
-
429
- Base. transpose (d:: TensorSpace ) = TensorSpace (d. spaces[2 ],d. spaces[1 ])
430
-
431
-
432
-
433
-
434
-
435
436
# # Transforms
436
437
function nDtransform_inner! (A, tempv, Rpre, Rpost, dim, plan!)
437
438
for indpost in Rpost, indpre in Rpre
0 commit comments