Mercurial > repos > public > sbplib_julia
view ext/DiffinitiveSparseArrayKitExt.jl @ 1811:89d7f7b02824 v0.1.3
Bump version to 0.1.3
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 03 Oct 2024 18:32:05 +0200 |
parents | 471a948cd2b2 |
children |
line wrap: on
line source
module DiffinitiveSparseArrayKitExt using Diffinitive using Diffinitive.LazyTensors using SparseArrayKit using Tokens """ SparseArray(t::LazyTensor) The sparse tensor representation of `t` with range dimensions to the left and domain dimensions to the right. If `L` is a `LazyTensor` with range and domain dimension 2 and `v` a 2-tensor, then `A = SparseArray(t)` is constructed so that `∑ₖ∑ₗA[i,j,k,l]*v[k,l] == L*v`. """ function SparseArrayKit.SparseArray(t::LazyTensor) v = ArrayToken(:v, domain_size(t)...) return Tokens._to_tensor(t*v, range_size(t), domain_size(t)) end end