So I have an algorithm that has several different steps to perform on matrices. I started declaring new types to ensure that matrices aren’t passed prematurely to the next step, or redundantly to a previous one.
For example, the function for step 1 might accept any old matrix,
but step 2 might want a matrix that is specifically in reduced row echelon form. For this I declared a structure that has one field that’s a sparse matrix.
struct SparseRREF R::SparseMatrixCSC end
I then would have
step_1_foo return type
SparseRREF and make the next function take
SparseRREF as its argument.
function step_2_foo(S::SparseRREF) M = S.R # etc... end
This is a little annoying because when I want to use the sparse matrix, I have to grab it from the struct first. Which leads me to my question.
Is there a better way of declaring these types? I don’t really want to add any functionality to the structure, other than to specify that it has been processed by a certain step. I don’t want to make an alias, because I don’t want any
Matrix to be seen accepted as a
SparseRREF type. Could I declare it as a type that inherits Matrix?