@@ -23,14 +23,12 @@ ArraySpace(sp::AbstractArray{SS,N}, f = first(sp)) where {SS<:Space,N} =
23
23
ArraySpace (S:: Space ,:: Val{n} ) where {n} = ArraySpace (@SArray fill (S,n... ))
24
24
ArraySpace (S:: Space ,n:: NTuple{N,Int} ) where {N} = ArraySpace (fill (S,n))
25
25
ArraySpace (S:: Space ,n:: Integer ) = ArraySpace (S,(n,))
26
- ArraySpace (S:: Space ,n,m) = ArraySpace (fill ( S,(n,m) ))
26
+ ArraySpace (S:: Space ,n,m) = ArraySpace (S,(n,m))
27
27
ArraySpace (d:: Domain ,n... ) = ArraySpace (Space (d),n... )
28
28
29
29
Space (sp:: AbstractArray{<:Space} ) = ArraySpace (sp)
30
- convert (:: Type{A} , sp:: ArraySpace ) where {A<: Array } = A (sp. spaces):: A
31
- Array (sp:: ArraySpace ) = convert (Array, sp. spaces)
32
- Vector (sp:: VectorSpace ) = convert (Vector, sp. spaces)
33
- Matrix (sp:: MatrixSpace ) = convert (Matrix, sp. spaces)
30
+ convert (:: Type{A} , sp:: ArraySpace ) where {A<: Array } = convert (A, sp. spaces):: A
31
+ (:: Type{A} )(sp:: ArraySpace ) where {A<: Array } = A (sp. spaces)
34
32
35
33
36
34
BlockInterlacer (sp:: ArraySpace ) = BlockInterlacer (map (blocklengths, Tuple (sp. spaces)))
@@ -170,21 +168,21 @@ end
170
168
# # routines
171
169
172
170
spacescompatible (AS:: ArraySpace ,BS:: ArraySpace ) =
173
- size (AS) == size (BS) && all (spacescompatible . (AS. spaces,BS. spaces))
171
+ size (AS) == size (BS) && all (((x,y),) -> spacescompatible (x,y), zip (AS. spaces,BS. spaces))
174
172
canonicalspace (AS:: ArraySpace ) = ArraySpace (canonicalspace .(AS. spaces))
175
173
evaluate (f:: AbstractVector ,S:: ArraySpace ,x) = map (g-> g (x),Fun (S,f))
176
174
175
+ == (A:: ArraySpace , B:: ArraySpace ) = size (A) == size (B) && all (((x,y),) -> x== y, zip (A. spaces, B. spaces))
177
176
178
177
# # choosedomainspace
179
178
180
- function choosedomainspace (A:: InterlaceOperator{T,1} ,sp:: ArraySpace ) where T
181
- # this ensures correct dispatch for unino
182
- sps = Vector {Space} (
183
- filter (x-> ! isambiguous (x),map (choosedomainspace,A. ops,sp. spaces)))
179
+ function choosedomainspace (A:: VectorInterlaceOperator , sp:: ArraySpace )
180
+ # this ensures correct dispatch for union
181
+ sps = filter (! isambiguous, map (choosedomainspace,A. ops,sp. spaces))
184
182
if isempty (sps)
185
183
UnsetSpace ()
186
184
else
187
- union ( sps... )
185
+ reduce (union, sps)
188
186
end
189
187
end
190
188
@@ -223,12 +221,12 @@ Fun(f::AbstractMatrix{FF},d::MatrixSpace) where {FF<:Fun} = Fun(d,coefficients(f
223
221
# columns are coefficients
224
222
function Fun (M:: AbstractMatrix{<:Number} ,sp:: MatrixSpace )
225
223
if size (M) ≠ size (sp)
226
- throw (DimensionMismatch ())
224
+ throw (DimensionMismatch (" size of array $( size (M)) doesn't match that of the space $( size (sp)) " ))
227
225
end
228
- Fun (map ((f,s) -> Fun (f,s),M, sp. spaces))
226
+ Fun (map (Fun, M, sp. spaces))
229
227
end
230
228
231
- Fun (M:: UniformScaling ,sp:: MatrixSpace ) = Fun (M . λ * Matrix (I ,size (sp)... ),sp)
229
+ Fun (M:: UniformScaling ,sp:: MatrixSpace ) = Fun (Matrix (M ,size (sp)),sp)
232
230
233
231
234
232
0 commit comments