Mercurial > repos > public > sbplib_julia
comparison src/LazyTensors/lazy_tensor_operations.jl @ 938:4a9a96d51940 bugfix/tensor_application_1d_cartesian_index
Fix dispatch issue when indexing a 1D TensorApplication with a CartiesianIndex
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 09 Mar 2022 11:19:17 +0100 |
parents | 76e5682d0e52 |
children | 1513355f64cd |
comparison
equal
deleted
inserted
replaced
921:de1625deb27e | 938:4a9a96d51940 |
---|---|
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 Base.getindex(ta::LazyTensorMappingApplication{T,R}, I::Vararg{Any,R}) where {T,R} = apply(ta.t, ta.o, I...) | 17 Base.getindex(ta::LazyTensorMappingApplication{T,R}, I::Vararg{Any,R}) where {T,R} = apply(ta.t, ta.o, I...) |
18 Base.getindex(ta::LazyTensorMappingApplication{T,1}, I::CartesianIndex{1}) where {T} = apply(ta.t, ta.o, I.I...) | |
18 Base.size(ta::LazyTensorMappingApplication) = range_size(ta.t) | 19 Base.size(ta::LazyTensorMappingApplication) = range_size(ta.t) |
19 # TODO: What else is needed to implement the AbstractArray interface? | 20 # TODO: What else is needed to implement the AbstractArray interface? |
20 | 21 |
21 Base.:*(a::TensorMapping, v::AbstractArray) = LazyTensorMappingApplication(a,v) | 22 Base.:*(a::TensorMapping, v::AbstractArray) = LazyTensorMappingApplication(a,v) |
22 Base.:*(a::TensorMapping, b::TensorMapping) = throw(MethodError(Base.:*,(a,b))) | 23 Base.:*(a::TensorMapping, b::TensorMapping) = throw(MethodError(Base.:*,(a,b))) |