Skip to content
  • Sponsor stdlib-js/ndarray

  • Notifications You must be signed in to change notification settings
  • Fork 3

Files

Failed to load latest commit information.

Latest commit

 Cannot retrieve latest commit at this time.

History

History

output-dtype-policies

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Policies

List of output ndarray data type policies.

Usage

var policies = require( '@stdlib/ndarray/output-dtype-policies' );

policies()

Returns a list of ndarray data type policies.

var out = policies();
// e.g., returns [ 'same', 'promoted', ... ]

The output array contains the following data type policies:

  • same: return the same data type.
  • promoted: return a promoted data type.
  • accumulation: return a data type amenable to accumulation.
  • boolean: return a boolean data type.
  • boolean_and_generic: return a boolean or "generic" data type.
  • signed_integer: return a signed integer data type.
  • signed_integer_and_generic: return a signed integer or "generic" data type.
  • unsigned_integer: return an unsigned integer data type.
  • unsigned_integer_and_generic: return an unsigned integer or "generic" data type.
  • integer: return an integer data type (i.e., either signed or unsigned).
  • integer_and_generic: return an integer (i.e., either signed or unsigned) or "generic" data type.
  • floating_point: return a floating-point data type (i.e., either real-valued or complex-valued).
  • floating_point_and_generic: return a floating-point (i.e., either real-valued or complex-valued) or "generic" data type.
  • real_floating_point: return a real-valued floating-point data type.
  • real_floating_point_and_generic: return a real-valued or "generic" floating-point data type.
  • complex_floating_point: return a complex-valued floating-point data type.
  • complex_floating_point_and_generic: return a complex-valued or "generic" floating-point data type.
  • real: return a real-valued data type.
  • real_and_generic: return a real-valued or "generic" data type.
  • numeric: return a numeric data type.
  • numeric_and_generic: return a numeric or "generic" data type.
  • integer_index: return an integer index data type.
  • integer_index_and_generic: return an integer index or "generic" data type.
  • boolean_index: return a boolean index data type.
  • boolean_index_and_generic: return a boolean index or "generic" data type.
  • mask_index: return a mask index data type.
  • mask_index_and_generic: return a mask index or "generic" data type.
  • default: return the default data type.
  • default_index: return the default index data type.

Examples

var indexOf = require( '@stdlib/utils/index-of' );
var policies = require( '@stdlib/ndarray/output-dtype-policies' );

var POLICIES = policies();

function isPolicy( str ) {
    if ( indexOf( POLICIES, str ) === -1 ) {
        return false;
    }
    return true;
}

var bool = isPolicy( 'same' );
// returns true

bool = isPolicy( 'real_floating_point' );
// returns true

bool = isPolicy( 'promoted' );
// returns true

bool = isPolicy( 'beep' );
// returns false