Returns true when every item in a matrix is 0.
Every item must be 0: [[0, 0], [0, 0]] passes and [[0, 0], [0, 0.001]] fails.
Subtracting a matrix from itself leaves zeros, so matrix.is_zero(matrix.diff(a, b)) tests whether a and b hold the same items.
Syntax
matrix.is_zero(id: matrix<int/float>) -> series bool
matrix.is_zero() -> series boolArguments
| Name | Type | Default | Description |
|---|---|---|---|
| id | matrix<int/ | required | The matrix checked for items that are all 0; a single non-zero item makes the result false. |
Returns
series bool: true when every item is 0, otherwise false.series bool: true when the receiving matrix holds only zeros, otherwise false.
Example
//@version=6
indicator("matrix.is_zero: equal?", overlay = false)
matrix<float> a = matrix.new<float>(2, 2, 3.0)
b = matrix.copy(a)
plot(matrix.is_zero(matrix.diff(a, b)) ? 1 : 0, "Equal")See also
Runs on Sidechair