Multiply a special sparse 3D tensor with a vector in python
I have a 3D tensor T
of size (nrows, ncols, ncols)
, which I would like to multiply with a vector x
of size nrows
.
However, T
will be a huge sparse tensor with 6×6
nonzero entries in each row;
thus, it would be useful to store T
in a sparse format.
The most convenient way would be to define a Tsparse
tensor of size (nrows, 6, 6)
and a “pointer” matrix p
of size (nrows, 6)
which stores the indices of the nonzero entries for each row.