-
Notifications
You must be signed in to change notification settings - Fork 4
compute signum
kgryte edited this page May 12, 2015
·
1 revision
Evaluates the signum function, where x
may be a single numeric
value or a numeric array
.
var sgn = compute.signum( -10 );
// returns -1
var sgns = compute.signum( [ -10, -1, -0, 0, 1, 10 ] );
// returns [ -1, -1, -0, 0, 1, 1 ]
For object arrays
, provide an accessor function
for accessing numeric
values.
var data = [
[1,-10],
[2,-1],
[3,-0],
[4,0],
[5,1],
[6,10]
];
function getValue( d, i ) {
return d[ 1 ];
}
var sgns = compute.signum( data, {
'accessor': getValue
});
// returns [ -1, -1, -0, 0, 1, 1 ]
For additional options
, see compute-signum.
- Utilities
- Array Creation
- Sorting and Reshaping Arrays
- Special Functions
- Arithmetic
- Relational Operations
- Logical Operations
- Trigonometry
- Geometry
- Sets
- Discrete Mathematics
- Linear Algebra
- Statistics