comparison src/LazyTensors/lazy_tensor_operations.jl @ 1088:62f321caa964 refactor/sbpoperators/inflation

Improve docs
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 10 May 2022 20:21:15 +0200
parents f857057e61e6
children 2278730f9cee
comparison
equal deleted inserted replaced
1044:f857057e61e6 1088:62f321caa964
268 LazyOuterProduct(tms::Vararg{LazyTensor}) = foldl(LazyOuterProduct, tms) 268 LazyOuterProduct(tms::Vararg{LazyTensor}) = foldl(LazyOuterProduct, tms)
269 269
270 270
271 271
272 """ 272 """
273 inflate(tm, sz, dir) 273 inflate(tm::LazyTensor, sz, dir)
274 274
275 Inflate `tm` with identity tensors in all directions `d` for `d != dir`. 275 Inflate `tm` such that it gets the size `sz` in all directions except `dir`.
276 276 Here `sz[dir]` is ignored and replaced with the range and domains size of
277 # TODO: Describe when it is useful 277 `tm`.
278
279 An example of when this operation is useful is when extending a one
280 dimensional difference operator `D` to a 2D grid of a ceratin size. In that
281 case we could have
282
283 ```julia
284 Dx = inflate(D, (10,10), 1)
285 Dy = inflate(D, (10,10), 2)
286 ```
278 """ 287 """
279 function inflate(tm::LazyTensor, sz, dir) 288 function inflate(tm::LazyTensor, sz, dir)
280 Is = IdentityTensor{eltype(tm)}.(sz) 289 Is = IdentityTensor{eltype(tm)}.(sz)
281 parts = Base.setindex(Is, tm, dir) 290 parts = Base.setindex(Is, tm, dir)
282 return foldl(⊗, parts) 291 return foldl(⊗, parts)