Here is the problem:
I need to repeatly assign a given value to part of a large matrix, assume the following test code 1:
From the profiling, it could be seen that the assigment takes the major time of computation. But as shown in test code 2:
Assignment of data to a same size reduced matrix only takes negligible time cost compared with the code 1. It indicate the indexing into the large matrix may be the bottleneck of the algorithm.
So is there any way to speedup the indexing process? Or is there any alternative way to make the similar assignment?