comparison ext/SbplibSparseArrayKitExt.jl @ 1708:8787b2f9f5f8 feature/lazy_tensors/sparse_conversions

Add docstrings
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 04 Sep 2024 22:47:41 +0200
parents 3e9c3986930d
children 7379f492c4b3
comparison
equal deleted inserted replaced
1699:3e9c3986930d 1708:8787b2f9f5f8
4 using Sbplib.LazyTensors 4 using Sbplib.LazyTensors
5 5
6 using SparseArrayKit 6 using SparseArrayKit
7 using Tokens 7 using Tokens
8 8
9 """
10 SparseArray(t::LazyTensor)
11
12 The sparse tensor representation of `t` with range dimensions to the left and
13 domain dimensions to the right. If `L` is a `LazyTensor` with range and
14 domain dimension 2 and `v` a 2-tensor, then `A = SparseArray(t)` is
15 constructed so that `∑ₖ∑ₗA[i,j,k,l]*v[k,l] == L*v`§
16 """
9 function SparseArrayKit.SparseArray(t::LazyTensor) 17 function SparseArrayKit.SparseArray(t::LazyTensor)
10 v = ArrayToken(:v, domain_size(t)...) 18 v = ArrayToken(:v, domain_size(t)...)
11 return Tokens._to_tensor(t*v, range_size(t), domain_size(t)) 19 return Tokens._to_tensor(t*v, range_size(t), domain_size(t))
12 end 20 end
13 21