README.md (2565B)
1 <!-- 2 3 @license Apache-2.0 4 5 Copyright (c) 2018 The Stdlib Authors. 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18 19 --> 20 21 # isRowMajor 22 23 > Given a stride array, determine whether an array is row-major. 24 25 <!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> 26 27 <section class="intro"> 28 29 </section> 30 31 <!-- /.intro --> 32 33 <!-- Package usage documentation. --> 34 35 <section class="usage"> 36 37 ## Usage 38 39 ```javascript 40 var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major' ); 41 ``` 42 43 #### isRowMajor( strides ) 44 45 Returns a `boolean` indicating if an array is row-major based on a provided stride array. 46 47 ```javascript 48 var bool = isRowMajor( [ 2, 1 ] ); 49 // returns true 50 51 bool = isRowMajor( [ 1, 2 ] ); 52 // returns false 53 ``` 54 55 </section> 56 57 <!-- /.usage --> 58 59 <!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 60 61 <section class="notes"> 62 63 </section> 64 65 <!-- /.notes --> 66 67 <!-- Package usage examples. --> 68 69 <section class="examples"> 70 71 ## Examples 72 73 <!-- eslint no-undef: "error" --> 74 75 ```javascript 76 var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); 77 var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major' ); 78 79 var shape = [ 10, 10, 10 ]; 80 81 var strides = shape2strides( shape, 'row-major' ); 82 // returns [ 100, 10, 1 ] 83 84 var bool = isRowMajor( strides ); 85 // returns true 86 87 strides = shape2strides( shape, 'column-major' ); 88 // returns [ 1, 10, 100 ] 89 90 bool = isRowMajor( strides ); 91 // returns false 92 ``` 93 94 </section> 95 96 <!-- /.examples --> 97 98 <!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 99 100 <section class="references"> 101 102 </section> 103 104 <!-- /.references --> 105 106 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 107 108 <section class="links"> 109 110 </section> 111 112 <!-- /.links -->