I have the following defintion

arr = SymmetrizedArray[{1, 2} -> 1, {4, 4}, Antisymmetric[{1, 2}]]

which gives a StructuredArray with one entry {1,2}->1. I would like to map this array to a new one on a (key,value) basis, i.e. the desired result would look like something like this:

desiredResult = SymmetrizedArray[f[{1, 2}] -> g[1], {4, 4}, Antisymmetric[{1, 2}]]

How do I go about this without converting to a normal matrix?

I found out that for SparseArray one can do

SparseArray[{{1, 2} -> 1, {2, 1} -> -1}, {4, 4}]["NonzeroPositions"]

to get all available keys, but I actually would like to not convert my StructuredArray to a SparseArray to keep the number of entries at a minimum. Unfortunately an analogous syntax doesn't work with SparseArray.

Thanks a lot!



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.