Sidechair

matrix.is_antisymmetric()

Browse the reference

Returns true when a matrix equals the negative of its transpose.

Try it in the editor

Item (i, j) must equal minus item (j, i): [[0, 2], [-2, 0]] passes, while [[1, 2], [-2, 1]] fails because its diagonal items are not 0.

That rule forces every main-diagonal item to be 0, since a number only equals its own negative when it is zero. Rotation generators have this form, and a matrix that is not square cannot qualify.

Syntax

Pine Script
matrix.is_antisymmetric(id: matrix<int/float>) -> series bool
matrix.is_antisymmetric() -> series bool

Arguments

NameTypeDefaultDescription
idmatrix<int/float>requiredThe matrix compared with the negative of its transpose; its main diagonal therefore has to be all zeros.

Returns

  • series bool: true when the matrix equals the negative of its transpose, otherwise false.
  • series bool: true when the receiving matrix is antisymmetric, otherwise false.

Example

Pine ScriptSkew pairOpen in editor
//@version=6
indicator("matrix.is_antisymmetric: skew", overlay = false)
matrix<float> m = matrix.new<float>(2, 2, 0.0)
matrix.set(m, 0, 1, 2.0)
matrix.set(m, 1, 0, -2.0)
plot(matrix.is_antisymmetric(m) ? 1 : 0, "Antisymmetric")

See also

Runs on Sidechair