comparison src/LazyTensors/lazy_tensor_operations.jl @ 1295:87576b0ca0e3 performance/lazy_tensors

Add callsite inline for better type inference
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Wed, 05 Oct 2022 13:15:32 +0200
parents 2e606d4c0ab1
children
comparison
equal deleted inserted replaced
1111:5b3d4a8ec3ab 1295:87576b0ca0e3
89 89
90 range_size(tm::TensorComposition) = range_size(tm.t1) 90 range_size(tm::TensorComposition) = range_size(tm.t1)
91 domain_size(tm::TensorComposition) = domain_size(tm.t2) 91 domain_size(tm::TensorComposition) = domain_size(tm.t2)
92 92
93 function apply(c::TensorComposition{T,R,K,D}, v::AbstractArray{<:Any,D}, I::Vararg{Any,R}) where {T,R,K,D} 93 function apply(c::TensorComposition{T,R,K,D}, v::AbstractArray{<:Any,D}, I::Vararg{Any,R}) where {T,R,K,D}
94 apply(c.t1, c.t2*v, I...) 94 apply(c.t1, @inline c.t2*v, I...)
95 end 95 end
96 96
97 function apply_transpose(c::TensorComposition{T,R,K,D}, v::AbstractArray{<:Any,R}, I::Vararg{Any,D}) where {T,R,K,D} 97 function apply_transpose(c::TensorComposition{T,R,K,D}, v::AbstractArray{<:Any,R}, I::Vararg{Any,D}) where {T,R,K,D}
98 apply_transpose(c.t2, c.t1'*v, I...) 98 apply_transpose(c.t2, @inline c.t1'*v, I...)
99 end 99 end
100 100
101 """ 101 """
102 TensorComposition(tm, tmi::IdentityTensor) 102 TensorComposition(tm, tmi::IdentityTensor)
103 TensorComposition(tmi::IdentityTensor, tm) 103 TensorComposition(tmi::IdentityTensor, tm)