Module elementwise

Module elementwise 

Source
Expand description

Element-wise operations for matrices and scalars

This module implements language-compatible element-wise operations (.*, ./, .^) These operations work element-by-element on matrices and support scalar broadcasting.

Functionsยง

elementwise_add
Element-wise addition: A + B Supports matrix-matrix, matrix-scalar, and scalar-matrix operations
elementwise_div
Element-wise division: A ./ B Supports matrix-matrix, matrix-scalar, and scalar-matrix operations
elementwise_mul
Element-wise multiplication: A .* B Supports matrix-matrix, matrix-scalar, and scalar-matrix operations
elementwise_neg
Element-wise negation: -A Supports scalars and matrices
elementwise_pow
Element-wise power: A .^ B Supports matrix-matrix, matrix-scalar, and scalar-matrix operations
elementwise_sub
Element-wise subtraction: A - B Supports matrix-matrix, matrix-scalar, and scalar-matrix operations
power
Regular power operation: A ^ B
For matrices, this is matrix exponentiation (A^n where n is integer) For scalars, this is regular exponentiation