I discovered that my application is spending quite a bit of time concatenating sparse matrices with statements occurring inside of loops of the form
A = [B C
C' D]
and the like. In my application, although the numerical entries change, the positions are usually unchanged. So it would be great if there were a function or package so that I could say:
A = concat_via_schema(schema, [[B, C], [transp(C), D]])
where the schema
is precomputed, and the entries are immediately scattered to the correct locations in memory according to the plan. Actually, such a system of preallocating and precomputing destinations would be helpful for many sparse matrix operations (mat-mat-mult etc) that appear inside of loops. Are there any packages or functions like this?