elementMultiply method
Returns a new matrix with the exponential of each element of the matrix.
Example:
var matrix = Matrix([[1.0, 2.0], [3.0, 4.0]]);
print(matrix.exp()); // Output: [[2.718281828459045, 7.38905609893065], [20.085536923187668, 54.598150033144236]]
Multiplies the corresponding elements of this matrix and the given matrix.
other: The matrix to element-wise multiply with this matrix.
Returns a new matrix containing the result of the element-wise multiplication.
Example:
var matrixA = Matrix([[1, 2], [3, 4]]);
var matrixB = Matrix([[2, 2], [2, 2]]);
var result = matrixA.elementMultiply(matrixB);
print(result);
// Output:
// 2 4
// 6 8
Implementation
// Matrix exp() {
// return Matrix(_data.map((row) => row.map(math.exp).toList()).toList());
// }
/// Multiplies the corresponding elements of this matrix and the given matrix.
///
/// [other]: The matrix to element-wise multiply with this matrix.
///
/// Returns a new matrix containing the result of the element-wise multiplication.
///
/// Example:
/// ```dart
/// var matrixA = Matrix([[1, 2], [3, 4]]);
/// var matrixB = Matrix([[2, 2], [2, 2]]);
/// var result = matrixA.elementMultiply(matrixB);
/// print(result);
/// // Output:
/// // 2 4
/// // 6 8
/// ```
Matrix elementMultiply(Matrix other) {
return elementWise(other, (a, b) => a * b);
}