Mercurial > repos > public > sbplib_julia
comparison src/LazyTensors/lazy_tensor_operations.jl @ 518:a5caa934b35f feature/boundary_ops
Add getindex specialized for TensorMappings with zero range dim. Remove some unused type parameters.
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Tue, 24 Nov 2020 18:47:42 +0100 |
parents | 4b9d124fe984 |
children | 8f7919a9b398 |
comparison
equal
deleted
inserted
replaced
517:2edacece1637 | 518:a5caa934b35f |
---|---|
13 end | 13 end |
14 # TODO: Do boundschecking on creation! | 14 # TODO: Do boundschecking on creation! |
15 export LazyTensorMappingApplication | 15 export LazyTensorMappingApplication |
16 | 16 |
17 # TODO: Go through and remove unneccerary type parameters on functions | 17 # TODO: Go through and remove unneccerary type parameters on functions |
18 | 18 Base.getindex(ta::LazyTensorMappingApplication{T,0}, I::Index) where T = apply(ta.t, ta.o, I) |
19 Base.getindex(ta::LazyTensorMappingApplication{T,R,D}, I::Vararg{Index,R}) where {T,R,D} = apply(ta.t, ta.o, I...) | 19 Base.getindex(ta::LazyTensorMappingApplication{T,R}, I::Vararg{Index,R}) where {T,R} = apply(ta.t, ta.o, I...) |
20 Base.getindex(ta::LazyTensorMappingApplication{T,R,D}, I::Vararg{Int,R}) where {T,R,D} = apply(ta.t, ta.o, Index{Unknown}.(I)...) | 20 Base.getindex(ta::LazyTensorMappingApplication{T,R}, I::Vararg{Int,R}) where {T,R} = apply(ta.t, ta.o, Index{Unknown}.(I)...) |
21 Base.size(ta::LazyTensorMappingApplication) = range_size(ta.t) | 21 Base.size(ta::LazyTensorMappingApplication) = range_size(ta.t) |
22 # TODO: What else is needed to implement the AbstractArray interface? | 22 # TODO: What else is needed to implement the AbstractArray interface? |
23 | 23 |
24 Base.:*(a::TensorMapping, v::AbstractArray) = LazyTensorMappingApplication(a,v) | 24 Base.:*(a::TensorMapping, v::AbstractArray) = LazyTensorMappingApplication(a,v) |
25 Base.:*(a::TensorMapping, b::TensorMapping) = throw(MethodError(Base.:*,(a,b))) | 25 Base.:*(a::TensorMapping, b::TensorMapping) = throw(MethodError(Base.:*,(a,b))) |