Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "ndarray/base/ndarraylike2object/docs/types/index.d"

Index

Interfaces

Type aliases

Functions

Type aliases

Getter

Getter: (buf: ndarray["data"], idx: number) => any

Returns an ndarray element.

param

ndarray data buffer

param

element index

returns

element value

Type declaration

    • (buf: ndarray["data"], idx: number): any
    • Parameters

      • buf: ndarray["data"]
      • idx: number

      Returns any

Setter

Setter: (buf: ndarray["data"], idx: number, value: any) => void

Sets an ndarray element.

param

ndarray data buffer

param

element index

param

value to set

Type declaration

    • (buf: ndarray["data"], idx: number, value: any): void
    • Parameters

      • buf: ndarray["data"]
      • idx: number
      • value: any

      Returns void

Functions

Export assignment ndarraylike2object

  • Converts an ndarray-like to an object likely to have the same "shape".

    Notes

    • This function is intended as a potential performance optimization. In V8, for example, even if two objects share common properties, if those properties were added in different orders or if one object has additional properties not shared by the other object, then those objects will have different "hidden" classes. If a function is provided many objects having different "shapes", some JavaScript VMs (e.g., V8) will consider the function "megamorphic" and fail to perform various runtime optimizations. Accordingly, the intent of this function is to standardize the "shape" of the object holding ndarray meta data to ensure that internal functions operating on ndarrays are provided consistent argument "shapes".

    Parameters

    Returns ndarrayObject

    object containing ndarray data

    Example

    var array = require( `@stdlib/ndarray/array` );
    
    var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] );
    
    var obj = ndarraylike2object( x );
    // returns {...}