Strided tensor
Implement the final Layout
option for Tensor_
s: StridedLayout
. Strided layouts will essentially make no assumptions about how the data is organized in memory, instead only using the stride_
member variable of Tensor_
to compute indices. The motivating use case for StridedTensor_
is to be able to obtain a "view" of the diagonal elements of a tensor so that we can do something like
Tensor<1> fock_eigenvalues = fock_matrix.diagonal();
Many external libraries/functions will not be compatible with fully strided layouts, so these interfaces will have to be disabled for StridedTensor_
. This adds a bit of complexity because it will be the first time functions like gemm()
care about the layout details.
-
StridedTensor_
prototype that can be used with a simplediagonal()
-
ConstStridedTensor_
prototype that can be used with a simpleconst_diagonal()
-
norm()
(or move to separate function) -
reorder()
-
transpose()
-
concept for compatibility with strided tensors -
disable functions that are incompatible with strided tensors -
gemm -
verify that contract works -
most linalg
-
-
test cases for multidimensional strided tensors
Edit 1
Easiest way to make sure StridedTensor_
s doesn't get used in unsafe code is to just update the definition of tensorable
(and hence basically all existing functions) to require contiguous or columnwise storage. So by default, algorithms will not work with StridedTensor_
s, but instead qleve functions will have to opt in.