README.md (8116B)
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 # ndarray 22 23 [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] [![dependencies][dependencies-image]][dependencies-url] 24 25 > Multidimensional arrays. 26 27 <section class="installation"> 28 29 ## Installation 30 31 ```bash 32 npm install @stdlib/ndarray 33 ``` 34 35 </section> 36 37 <section class="usage"> 38 39 ## Usage 40 41 ```javascript 42 var ns = require( '@stdlib/ndarray' ); 43 ``` 44 45 #### ns 46 47 ndarray namespace. 48 49 ```javascript 50 var o = ns; 51 // returns {...} 52 ``` 53 54 The namespace exports the following functions to create multidimensional arrays: 55 56 <!-- <toc pattern="+(array|ctor)"> --> 57 58 <div class="namespace-toc"> 59 60 - <span class="signature">[`array( [buffer,] [options] )`][@stdlib/ndarray/array]</span><span class="delimiter">: </span><span class="description">create a multidimensional array.</span> 61 - <span class="signature">[`ndarray( dtype, buffer, shape, strides, offset, order[, options] )`][@stdlib/ndarray/ctor]</span><span class="delimiter">: </span><span class="description">multidimensional array constructor.</span> 62 63 </div> 64 65 <!-- </toc> --> 66 67 The namespace contains the following sub-namespaces: 68 69 <!-- <toc pattern="base"> --> 70 71 <div class="namespace-toc"> 72 73 - <span class="signature">[`base`][@stdlib/ndarray/base]</span><span class="delimiter">: </span><span class="description">base ndarray.</span> 74 75 </div> 76 77 <!-- </toc> --> 78 79 In addition, the namespace contaians the following multidimensional array utility functions: 80 81 <!-- <toc pattern="*" > --> 82 83 <div class="namespace-toc"> 84 85 - <span class="signature">[`ndarrayCastingModes()`][@stdlib/ndarray/casting-modes]</span><span class="delimiter">: </span><span class="description">list of ndarray casting modes.</span> 86 - <span class="signature">[`ndarrayDataTypes()`][@stdlib/ndarray/dtypes]</span><span class="delimiter">: </span><span class="description">list of ndarray data types.</span> 87 - <span class="signature">[`ind2sub( shape, idx[, options] )`][@stdlib/ndarray/ind2sub]</span><span class="delimiter">: </span><span class="description">convert a linear index to an array of subscripts.</span> 88 - <span class="signature">[`ndarrayIndexModes()`][@stdlib/ndarray/index-modes]</span><span class="delimiter">: </span><span class="description">list of ndarray index modes.</span> 89 - <span class="signature">[`ndarrayMinDataType( value )`][@stdlib/ndarray/min-dtype]</span><span class="delimiter">: </span><span class="description">determine the minimum ndarray data type of the closest "kind" necessary for storing a provided scalar value.</span> 90 - <span class="signature">[`ndarrayNextDataType( [dtype] )`][@stdlib/ndarray/next-dtype]</span><span class="delimiter">: </span><span class="description">return the next larger ndarray data type of the same kind.</span> 91 - <span class="signature">[`ndarrayOrders()`][@stdlib/ndarray/orders]</span><span class="delimiter">: </span><span class="description">list of ndarray orders.</span> 92 - <span class="signature">[`ndarrayPromotionRules( [dtype1, dtype2] )`][@stdlib/ndarray/promotion-rules]</span><span class="delimiter">: </span><span class="description">return the ndarray data type with the smallest size and closest "kind" to which ndarray data types can be **safely** cast.</span> 93 - <span class="signature">[`ndarraySafeCasts( [dtype] )`][@stdlib/ndarray/safe-casts]</span><span class="delimiter">: </span><span class="description">return a list of ndarray data types to which a provided ndarray data type can be safely cast.</span> 94 - <span class="signature">[`ndarraySameKindCasts( [dtype] )`][@stdlib/ndarray/same-kind-casts]</span><span class="delimiter">: </span><span class="description">return a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind".</span> 95 - <span class="signature">[`sub2ind( shape, ...subscripts[, options] )`][@stdlib/ndarray/sub2ind]</span><span class="delimiter">: </span><span class="description">convert subscripts to a linear index.</span> 96 97 </div> 98 99 <!-- </toc> --> 100 101 </section> 102 103 <!-- /.usage --> 104 105 <section class="examples"> 106 107 ## Examples 108 109 <!-- TODO: better examples --> 110 111 <!-- eslint no-undef: "error" --> 112 113 ```javascript 114 var objectKeys = require( '@stdlib/utils/keys' ); 115 var ns = require( '@stdlib/ndarray' ); 116 117 console.log( objectKeys( ns ) ); 118 ``` 119 120 </section> 121 122 <!-- /.examples --> 123 124 125 <section class="main-repo" > 126 127 * * * 128 129 ## Notice 130 131 This package is part of [stdlib][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. 132 133 For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. 134 135 #### Community 136 137 [![Chat][chat-image]][chat-url] 138 139 --- 140 141 ## License 142 143 See [LICENSE][stdlib-license]. 144 145 146 ## Copyright 147 148 Copyright © 2016-2021. The Stdlib [Authors][stdlib-authors]. 149 150 </section> 151 152 <!-- /.stdlib --> 153 154 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 155 156 <section class="links"> 157 158 [npm-image]: http://img.shields.io/npm/v/@stdlib/ndarray.svg 159 [npm-url]: https://npmjs.org/package/@stdlib/ndarray 160 161 [test-image]: https://github.com/stdlib-js/ndarray/actions/workflows/test.yml/badge.svg 162 [test-url]: https://github.com/stdlib-js/ndarray/actions/workflows/test.yml 163 164 [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/ndarray/main.svg 165 [coverage-url]: https://codecov.io/github/stdlib-js/ndarray?branch=main 166 167 [dependencies-image]: https://img.shields.io/david/stdlib-js/ndarray.svg 168 [dependencies-url]: https://david-dm.org/stdlib-js/ndarray/main 169 170 [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg 171 [chat-url]: https://gitter.im/stdlib-js/stdlib/ 172 173 [stdlib]: https://github.com/stdlib-js/stdlib 174 175 [stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors 176 177 [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/ndarray/main/LICENSE 178 179 <!-- <toc-links> --> 180 181 [@stdlib/ndarray/casting-modes]: https://www.npmjs.com/package/@stdlib/ndarray/tree/main/casting-modes 182 183 [@stdlib/ndarray/dtypes]: https://www.npmjs.com/package/@stdlib/ndarray/tree/main/dtypes 184 185 [@stdlib/ndarray/ind2sub]: https://www.npmjs.com/package/@stdlib/ndarray/tree/main/ind2sub 186 187 [@stdlib/ndarray/index-modes]: https://www.npmjs.com/package/@stdlib/ndarray/tree/main/index-modes 188 189 [@stdlib/ndarray/min-dtype]: https://www.npmjs.com/package/@stdlib/ndarray/tree/main/min-dtype 190 191 [@stdlib/ndarray/next-dtype]: https://www.npmjs.com/package/@stdlib/ndarray/tree/main/next-dtype 192 193 [@stdlib/ndarray/orders]: https://www.npmjs.com/package/@stdlib/ndarray/tree/main/orders 194 195 [@stdlib/ndarray/promotion-rules]: https://www.npmjs.com/package/@stdlib/ndarray/tree/main/promotion-rules 196 197 [@stdlib/ndarray/safe-casts]: https://www.npmjs.com/package/@stdlib/ndarray/tree/main/safe-casts 198 199 [@stdlib/ndarray/same-kind-casts]: https://www.npmjs.com/package/@stdlib/ndarray/tree/main/same-kind-casts 200 201 [@stdlib/ndarray/sub2ind]: https://www.npmjs.com/package/@stdlib/ndarray/tree/main/sub2ind 202 203 [@stdlib/ndarray/base]: https://www.npmjs.com/package/@stdlib/ndarray/tree/main/base 204 205 [@stdlib/ndarray/array]: https://www.npmjs.com/package/@stdlib/ndarray/tree/main/array 206 207 [@stdlib/ndarray/ctor]: https://www.npmjs.com/package/@stdlib/ndarray/tree/main/ctor 208 209 <!-- </toc-links> --> 210 211 </section> 212 213 <!-- /.links -->