pow method

Matrix pow(
  1. num exponent
)

Returns a new matrix with each element raised to the power of exponent.

Example:

var matrix = Matrix([[1.0, 2.0], [3.0, 4.0]]);
print(matrix.pow(2)); // Output: [[1.0, 4.0], [9.0, 16.0]]

Implementation

Matrix pow(num exponent) {
  return Matrix(_data
      .map((row) => row.map((cell) => math.pow(cell, exponent)).toList())
      .toList());
}