@stdlib/ndarray-base-assert-is-row-major
    TypeScript icon, indicating that this package has built-in type declarations

    0.0.5 • Public • Published

    isRowMajor

    NPM version Build Status Coverage Status dependencies

    Given a stride array, determine whether an array is row-major.

    Installation

    npm install @stdlib/ndarray-base-assert-is-row-major

    Usage

    var isRowMajor = require( '@stdlib/ndarray-base-assert-is-row-major' );

    isRowMajor( strides )

    Returns a boolean indicating if an array is row-major based on a provided stride array.

    var bool = isRowMajor( [ 2, 1 ] );
    // returns true
    
    bool = isRowMajor( [ 1, 2 ] );
    // returns false

    Examples

    var shape2strides = require( '@stdlib/ndarray-base-shape2strides' );
    var isRowMajor = require( '@stdlib/ndarray-base-assert-is-row-major' );
    
    var shape = [ 10, 10, 10 ];
    
    var strides = shape2strides( shape, 'row-major' );
    // returns [ 100, 10, 1 ]
    
    var bool = isRowMajor( strides );
    // returns true
    
    strides = shape2strides( shape, 'column-major' );
    // returns [ 1, 10, 100 ]
    
    bool = isRowMajor( strides );
    // returns false

    Notice

    This package is part of stdlib, a standard library for JavaScript and Node.js, 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-2021. The Stdlib Authors.

    Install

    npm i @stdlib/ndarray-base-assert-is-row-major

    Homepage

    stdlib.io

    DownloadsWeekly Downloads

    15

    Version

    0.0.5

    License

    Apache-2.0

    Unpacked Size

    39.7 kB

    Total Files

    12

    Last publish

    Collaborators

    • stdlib-bot
    • kgryte
    • planeshifter
    • rreusser