api / koma / sign

sign

fun sign(arr:Matrix<Double>):Matrix<Double>

Calculates a matrix consisting of the sign of each element in the input matrix. Returns -1 for positive values, -1 for negative values, 0 for 0.

Parameters

arr - An arbitrarily sized matrix

Return A matrix consisting of the operation performed element-wise.

fun sign(arr:Double):Double fun sign(arr:Int):Double

A convenience function performing the sign operation via the kotlin.math equivalent call.