I’m working on an expression language for handling (sometimes) sparse diagonal arrays. In index notation, these expressions look something like:
X[i,j], where i == j
X[i,j,k], where i == k
X[i,j,k], where j == k
etc. That is, X
is a matrix with only main diagonal having non-zero elements, e.g.:
X = 0.089022 0 0
0 0.0622766 0
0 0 0.374836
In vector notation, first expression is equivalent to Diagonal(X)
, but is there a way or array type to represent the same idea for 3D, 4D, etc. arrays?
Note, that I’m mostly interested in symbolic representation of these arrays for further transformations, but efficient (i.e. sparse) representation for them is also nice to have.