A great man once said, I have a matrix A
. But this time she has a friend B
. Like the Montagues and Capulets, they have different domains.
// A.domain is { 1..10, 1..10 }
// B.domain is { 0.. 9, 0.. 9 }
for ij in B.domain {
if B[ij] <has a condition> {
// poops
A[ij] = B[ij];
}
}
My guess is I need to reindex so that the B.domain
is {1..10, 1..10}
. Since B is an input, I get push back from the compiler. Any suggestions?
There's a
reindex
array method to accomplish exactly this, and you can create aref
to the result to prevent creating a new array: