I'm dealing with a big array D
with which I'm running into memory problems. However, the entries of that big array are in fact just copies of elements of a much smaller array B
. Now my idea would be to use something like a "dynamic view" into B
instead of constructing the full D
. For example, is it possible to use a function D_fun
like an array which the reads the correct element of B
? I.e. something like
def D_fun(B, I, J):
i = convert_i_idx(I, J)
j = convert_j_idx(I, J)
return B[i,j]
And then I could use D_fun
to do some matrix and vector multiplications.
Of course, anything else that would keep me form copying the elements of B
repeatedly into a huge matrix would be appreciated.
Edit: I realized that if I invest some time in my other code I can get the matrix D
to be a block matrix with the B
s on the diagonal and zeros otherwise.