Skip to content

stdlib-js/ndarray-output-dtype-policies

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About stdlib...

We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.

The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.

When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.

To join us in bringing numerical computing to the web, get started by checking us out on GitHub, and please consider financially supporting stdlib. We greatly appreciate your continued support!

Policies

NPM version Build Status Coverage Status

List of output ndarray data type policies.

Usage

import policies from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-output-dtype-policies@deno/mod.js';

You can also import the following named exports from the package:

import { enum } from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-output-dtype-policies@deno/mod.js';

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

import indexOf from 'https://cdn.jsdelivr.net/gh/stdlib-js/utils-index-of@deno/mod.js';
import policies from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-output-dtype-policies@deno/mod.js';

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

Notice

This package is part of stdlib, a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.

For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.

Community

Chat


License

See LICENSE.

Copyright

Copyright © 2016-2025. The Stdlib Authors.