Hello,
I am a looking for a package that allows me to dynamically change the indexing of an array. I’m aware of OffsetArrays but this is not what I need.
Say I have an 8 by 8 symmetric matrix A. I have an algorithm that defines the “merging” of two indices. Say that I merge indices 3 and 5 by doing A[3,:] .= (A[3,:] .+ A[5,:])./2
and the same for the columns. Then I can get rid of 5, in practice I do it with a view and an InvertedIndex
to exclude 5. So this view is a 7x7 matrix now.
The new elements at index 3 are in fact that of another node from a graph (that was defined by A), node 9. What I would like is a way to change the indexing of A such that
A[9,:]
gives me what’s in A[3,:]
, and A[3,:]
should be out of bounds. In other words, indexing A maps 3 to 9.
I suppose I could implement that myself but I’d like to avoid the risk of making mistakes if this already exists.
Thanks.