2

How do I change the value of each element in a Matrix that involves a function call. Something like

matrix[i,j] = funct(matrix[i,j]*2)-1;

Yang
  • 6,682
  • 20
  • 64
  • 96

1 Answers1

2

You can use MapInplace, for example:

matrix.MapInplace(Math.Sin);
matrix.MapInplace(x => Math.Sin(x-2));

Or as in your example

matrix.MapInplace(x => funct(x*2)-1);
Christoph Rüegg
  • 4,626
  • 1
  • 20
  • 34