Reputation: 161
Having a matrix like this in C#
double[,] M
I would like to get the same fast manipulation of its content as Matlab does. In particular, having this code in Matlab:
for i = 1:N
M(i, 1:i) = 1;
I would like to have its equivalent in C# without a second loop. I'm not sure about this, but as far as I know, Matlab uses a process called Vectorization for this line M(i, 1:i) = 1
, which is faster than me implementing a for loop from 1 to i setting each cell to 1. Maybe I'm wrong, please correct me.
So how can achieve a fast manipulation of matrices in C# like Matlab.
Upvotes: 0
Views: 3113
Reputation: 6526
A common solution is to use a matrix library like math.net numerics for matrix operations.
Upvotes: 1