How do I map individual data elements to the csc form of A? #647
Replies: 1 comment 1 reply
-
The A matrix is stored in a Compressed Sparse Column format, so that means that the data vector of the matrix (and also the data vector that should be passed into the update function) is basically composed of the columns of A stacked on top of eachother, starting from the left and going right (see e.g. https://www.numerical.rl.ac.uk/spral/doc/latest/C/csc_format.html). That means, given the column matrix
the CSC data vector is
So for instance, lets say A is a 3x4 matrix (3 rows, 4 columns) with the sparsity pattern
If we want to update the (2,2) element of the matrix, we would change the value in the 3rd element of the data vector (counting starting at 1), and if we want to update the (1,4) element we would change the value at the 7th element of the data vector (counting from 1). |
Beta Was this translation helpful? Give feedback.
-
Can anyone give me advice for how to create an index map for where each data element ends up in the csc array of A? I have a lot of data I'm trying to update in A and can't figure out a way to map the data to the final index.
I initially setup the problem for a 3 state MPC problem with a lot of custom constraints. If I want to iterate and try a different problem by adding or removing constraints, the data in the A update array shifts depending on the new constraint(s). At runtime, I can't use the same sparse functions I originally used to setup the problem so I need to have the indices/data map predetermined.
Thank you for any help!
Beta Was this translation helpful? Give feedback.
All reactions