{"id":21140671,"url":"https://github.com/stdlib-js/ndarray","last_synced_at":"2025-04-06T21:15:40.166Z","repository":{"id":41434612,"uuid":"360557175","full_name":"stdlib-js/ndarray","owner":"stdlib-js","description":"Multidimensional arrays.","archived":false,"fork":false,"pushed_at":"2025-04-04T05:04:34.000Z","size":133717,"stargazers_count":12,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-04T05:27:38.600Z","etag":null,"topics":["array","buffer","data","javascript","matrix","multidimensional","namespace","ndarray","node","node-js","nodejs","ns","stdlib","structures","tensor","typed","typed-array","types","vector"],"latest_commit_sha":null,"homepage":"https://github.com/stdlib-js/stdlib","language":"C","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stdlib-js.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["stdlib-js"],"open_collective":"stdlib","tidelift":"npm/@stdlib/stdlib"}},"created_at":"2021-04-22T14:56:16.000Z","updated_at":"2025-04-04T04:59:12.000Z","dependencies_parsed_at":"2025-01-13T01:21:40.122Z","dependency_job_id":"5a0ca16d-fdde-4cbd-9643-6d082de0cc2e","html_url":"https://github.com/stdlib-js/ndarray","commit_stats":{"total_commits":341,"total_committers":1,"mean_commits":341.0,"dds":0.0,"last_synced_commit":"3fae5bad7cedb6b5c66e3469eabd5d2792524608"},"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stdlib-js%2Fndarray","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stdlib-js%2Fndarray/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stdlib-js%2Fndarray/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stdlib-js%2Fndarray/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stdlib-js","download_url":"https://codeload.github.com/stdlib-js/ndarray/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247550691,"owners_count":20956987,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["array","buffer","data","javascript","matrix","multidimensional","namespace","ndarray","node","node-js","nodejs","ns","stdlib","structures","tensor","typed","typed-array","types","vector"],"created_at":"2024-11-20T07:17:07.702Z","updated_at":"2025-04-06T21:15:40.149Z","avatar_url":"https://github.com/stdlib-js.png","language":"C","readme":"\u003c!--\n\n@license Apache-2.0\n\nCopyright (c) 2018 The Stdlib Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\n--\u003e\n\n\n\u003cdetails\u003e\n  \u003csummary\u003e\n    About stdlib...\n  \u003c/summary\u003e\n  \u003cp\u003eWe 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.\u003c/p\u003e\n  \u003cp\u003eThe 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.\u003c/p\u003e\n  \u003cp\u003eWhen 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.\u003c/p\u003e\n  \u003cp\u003eTo join us in bringing numerical computing to the web, get started by checking us out on \u003ca href=\"https://github.com/stdlib-js/stdlib\"\u003eGitHub\u003c/a\u003e, and please consider \u003ca href=\"https://opencollective.com/stdlib\"\u003efinancially supporting stdlib\u003c/a\u003e. We greatly appreciate your continued support!\u003c/p\u003e\n\u003c/details\u003e\n\n# ndarray\n\n[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] \u003c!-- [![dependencies][dependencies-image]][dependencies-url] --\u003e\n\n\u003e Multidimensional arrays.\n\n\u003csection class=\"installation\"\u003e\n\n## Installation\n\n```bash\nnpm install @stdlib/ndarray\n```\n\nAlternatively,\n\n-   To load the package in a website via a `script` tag without installation and bundlers, use the [ES Module][es-module] available on the [`esm`][esm-url] branch (see [README][esm-readme]).\n-   If you are using Deno, visit the [`deno`][deno-url] branch (see [README][deno-readme] for usage intructions).\n-   For use in Observable, or in browser/node environments, use the [Universal Module Definition (UMD)][umd] build available on the [`umd`][umd-url] branch (see [README][umd-readme]).\n\nThe [branches.md][branches-url] file summarizes the available branches and displays a diagram illustrating their relationships.\n\nTo view installation and usage instructions specific to each branch build, be sure to explicitly navigate to the respective README files on each branch, as linked to above.\n\n\u003c/section\u003e\n\n\u003csection class=\"usage\"\u003e\n\n## Usage\n\n```javascript\nvar ns = require( '@stdlib/ndarray' );\n```\n\n#### ns\n\nndarray namespace.\n\n```javascript\nvar o = ns;\n// returns {...}\n```\n\nThe namespace exports the following functions to create multidimensional arrays:\n\n\u003c!-- \u003ctoc pattern=\"+(array|ctor)\"\u003e --\u003e\n\n\u003cdiv class=\"namespace-toc\"\u003e\n\n-   \u003cspan class=\"signature\"\u003e[`array( [buffer,] [options] )`][@stdlib/ndarray/array]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ecreate a multidimensional array.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`ndarray( dtype, buffer, shape, strides, offset, order[, options] )`][@stdlib/ndarray/ctor]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003emultidimensional array constructor.\u003c/span\u003e\n\n\u003c/div\u003e\n\n\u003c!-- \u003c/toc\u003e --\u003e\n\nThe namespace contains the following sub-namespaces:\n\n\u003c!-- \u003ctoc pattern=\"+(base|iter)\"\u003e --\u003e\n\n\u003cdiv class=\"namespace-toc\"\u003e\n\n-   \u003cspan class=\"signature\"\u003e[`base`][@stdlib/ndarray/base]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ebase ndarray.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`iter`][@stdlib/ndarray/iter]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003emultidimensional array iterators.\u003c/span\u003e\n\n\u003c/div\u003e\n\n\u003c!-- \u003c/toc\u003e --\u003e\n\nIn addition, the namespace contains the following multidimensional array utility functions:\n\n\u003c!-- \u003ctoc pattern=\"*\" \u003e --\u003e\n\n\u003cdiv class=\"namespace-toc\"\u003e\n\n-   \u003cspan class=\"signature\"\u003e[`at( x[, ...indices] )`][@stdlib/ndarray/at]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ereturn an `ndarray` element.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`broadcastArray( x, shape )`][@stdlib/ndarray/broadcast-array]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ebroadcast an ndarray to a specified shape.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`broadcastArrays( ...arrays )`][@stdlib/ndarray/broadcast-arrays]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ebroadcast ndarrays to a common shape.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`castingModes()`][@stdlib/ndarray/casting-modes]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003elist of ndarray casting modes.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`dataBuffer( x )`][@stdlib/ndarray/data-buffer]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ereturn the underlying data buffer of a provided ndarray.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`defaults()`][@stdlib/ndarray/defaults]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003edefault ndarray settings.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`dispatch( fcns, types, data, nargs, nin, nout )`][@stdlib/ndarray/dispatch]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ecreate an ndarray function interface which performs multiple dispatch.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`dtype( x )`][@stdlib/ndarray/dtype]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ereturn the data type of a provided ndarray.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`dtypes( [kind] )`][@stdlib/ndarray/dtypes]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003elist of ndarray data types.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`emptyLike( x[, options] )`][@stdlib/ndarray/empty-like]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ecreate an uninitialized ndarray having the same shape and data type as a provided ndarray.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`empty( shape[, options] )`][@stdlib/ndarray/empty]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ecreate an uninitialized ndarray having a specified shape and data type.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`FancyArray( dtype, buffer, shape, strides, offset, order[, options] )`][@stdlib/ndarray/fancy]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003efancy multidimensional array constructor.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`fillBy( x, fcn[, thisArg] )`][@stdlib/ndarray/fill-by]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003efill an input `ndarray` according to a callback function.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`fill( x, value )`][@stdlib/ndarray/fill]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003efill an input `ndarray` with a specified value.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`filterMap( x[, options], fcn[, thisArg] )`][@stdlib/ndarray/filter-map]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003efilter and map elements in an input ndarray to elements in a new output ndarray according to a callback function.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`filter( x[, options], predicate[, thisArg] )`][@stdlib/ndarray/filter]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ereturn a shallow copy of an ndarray containing only those elements which pass a test implemented by a predicate function.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`flag( x, name )`][@stdlib/ndarray/flag]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ereturn a specified flag for a provided ndarray.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`flags( x )`][@stdlib/ndarray/flags]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ereturn the flags of a provided ndarray.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`forEach( x, fcn[, thisArg] )`][@stdlib/ndarray/for-each]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003einvoke a callback function once for each ndarray element.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`scalar2ndarray( value[, options] )`][@stdlib/ndarray/from-scalar]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003econvert a scalar value to a zero-dimensional ndarray.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`ind2sub( shape, idx[, options] )`][@stdlib/ndarray/ind2sub]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003econvert a linear index to an array of subscripts.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`indexModes()`][@stdlib/ndarray/index-modes]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003elist of ndarray index modes.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`ndindex( x[, options] )`][@stdlib/ndarray/index]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003endarray index constructor.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`map( x[, options], fcn[, thisArg] )`][@stdlib/ndarray/map]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003eapply a callback function to elements in an input ndarray and assign results to elements in a new output ndarray.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`maybeBroadcastArray( x, shape )`][@stdlib/ndarray/maybe-broadcast-array]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ebroadcast an ndarray to a specified shape if and only if the specified shape differs from the provided ndarray's shape.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`maybeBroadcastArrays( arrays )`][@stdlib/ndarray/maybe-broadcast-arrays]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ebroadcast ndarrays to a common shape.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`minDataType( value )`][@stdlib/ndarray/min-dtype]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003edetermine the minimum ndarray data type of the closest \"kind\" necessary for storing a provided scalar value.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`mostlySafeCasts( [dtype] )`][@stdlib/ndarray/mostly-safe-casts]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ereturn a list of ndarray data types to which a provided ndarray data type can be safely cast and, for floating-point data types, can be downcast.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`ndarraylike2ndarray( x[, options] )`][@stdlib/ndarray/ndarraylike2ndarray]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003econvert an ndarray-like object to an `ndarray`.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`ndims( x )`][@stdlib/ndarray/ndims]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ereturn the number of ndarray dimensions.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`nextDataType( [dtype] )`][@stdlib/ndarray/next-dtype]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ereturn the next larger ndarray data type of the same kind.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`numelDimension( x, dim )`][@stdlib/ndarray/numel-dimension]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ereturn the size (i.e., number of elements) of a specified dimension for a provided ndarray.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`numel( x )`][@stdlib/ndarray/numel]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ereturn the number of elements in an ndarray.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`offset( x )`][@stdlib/ndarray/offset]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ereturn the index offset specifying the underlying buffer index of the first iterated ndarray element.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`order( x )`][@stdlib/ndarray/order]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ereturn the layout order of a provided ndarray.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`orders()`][@stdlib/ndarray/orders]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003elist of ndarray orders.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`outputDataTypePolicies()`][@stdlib/ndarray/output-dtype-policies]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003elist of output ndarray data type policies.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`promotionRules( [dtype1, dtype2] )`][@stdlib/ndarray/promotion-rules]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ereturn the ndarray data type with the smallest size and closest \"kind\" to which ndarray data types can be **safely** cast.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`reject( x[, options], predicate[, thisArg] )`][@stdlib/ndarray/reject]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ereturn a shallow copy of an ndarray containing only those elements which fail a test implemented by a predicate function.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`safeCasts( [dtype] )`][@stdlib/ndarray/safe-casts]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ereturn a list of ndarray data types to which a provided ndarray data type can be safely cast.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`sameKindCasts( [dtype] )`][@stdlib/ndarray/same-kind-casts]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ereturn a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same \"kind\".\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`shape( x )`][@stdlib/ndarray/shape]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ereturn the shape of a provided ndarray.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`sliceAssign( x, y, ...s[, options] )`][@stdlib/ndarray/slice-assign]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003eassign element values from a broadcasted input `ndarray` to corresponding elements in an output `ndarray` view.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`sliceDimensionFrom( x, dim, start[, options] )`][@stdlib/ndarray/slice-dimension-from]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ereturn a read-only shifted view of an input `ndarray` along a specified dimension.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`sliceDimensionTo( x, dim, stop[, options] )`][@stdlib/ndarray/slice-dimension-to]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ereturn a read-only truncated view of an input `ndarray` along a specified dimension.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`sliceDimension( x, dim, slice[, options] )`][@stdlib/ndarray/slice-dimension]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ereturn a read-only view of an input `ndarray` when sliced along a specified dimension.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`sliceFrom( x, ...start[, options] )`][@stdlib/ndarray/slice-from]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ereturn a read-only shifted view of an input ndarray.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`sliceTo( x, ...stop[, options] )`][@stdlib/ndarray/slice-to]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ereturn a read-only truncated view of an input ndarray.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`slice( x, ...s[, options] )`][@stdlib/ndarray/slice]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ereturn a read-only view of an input `ndarray`.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`stride( x, dim )`][@stdlib/ndarray/stride]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ereturn the stride along a specified dimension for a provided ndarray.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`strides( x )`][@stdlib/ndarray/strides]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ereturn the strides of a provided ndarray.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`sub2ind( shape, ...subscripts[, options] )`][@stdlib/ndarray/sub2ind]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003econvert subscripts to a linear index.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`ndarray2array( x )`][@stdlib/ndarray/to-array]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003econvert an ndarray to a generic array.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`ndarray2fancy( x[, options] )`][@stdlib/ndarray/to-fancy]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003econvert an ndarray to an object supporting fancy indexing.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`ndarray2json( x )`][@stdlib/ndarray/to-json]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003eserialize an ndarray as a JSON object.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`zerosLike( x[, options] )`][@stdlib/ndarray/zeros-like]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ecreate a zero-filled ndarray having the same shape and data type as a provided ndarray.\u003c/span\u003e\n-   \u003cspan class=\"signature\"\u003e[`zeros( shape[, options] )`][@stdlib/ndarray/zeros]\u003c/span\u003e\u003cspan class=\"delimiter\"\u003e: \u003c/span\u003e\u003cspan class=\"description\"\u003ecreate a zero-filled ndarray having a specified shape and data type.\u003c/span\u003e\n\n\u003c/div\u003e\n\n\u003c!-- \u003c/toc\u003e --\u003e\n\n\u003c/section\u003e\n\n\u003c!-- /.usage --\u003e\n\n\u003csection class=\"examples\"\u003e\n\n## Examples\n\n\u003c!-- TODO: better examples --\u003e\n\n\u003c!-- eslint no-undef: \"error\" --\u003e\n\n```javascript\nvar objectKeys = require( '@stdlib/utils/keys' );\nvar ns = require( '@stdlib/ndarray' );\n\nconsole.log( objectKeys( ns ) );\n```\n\n\u003c/section\u003e\n\n\u003c!-- /.examples --\u003e\n\n\u003c!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --\u003e\n\n\u003csection class=\"related\"\u003e\n\n\u003c/section\u003e\n\n\u003c!-- /.related --\u003e\n\n\u003c!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --\u003e\n\n\n\u003csection class=\"main-repo\" \u003e\n\n* * *\n\n## Notice\n\nThis 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.\n\nFor 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].\n\n#### Community\n\n[![Chat][chat-image]][chat-url]\n\n---\n\n## License\n\nSee [LICENSE][stdlib-license].\n\n\n## Copyright\n\nCopyright \u0026copy; 2016-2025. The Stdlib [Authors][stdlib-authors].\n\n\u003c/section\u003e\n\n\u003c!-- /.stdlib --\u003e\n\n\u003c!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --\u003e\n\n\u003csection class=\"links\"\u003e\n\n[npm-image]: http://img.shields.io/npm/v/@stdlib/ndarray.svg\n[npm-url]: https://npmjs.org/package/@stdlib/ndarray\n\n[test-image]: https://github.com/stdlib-js/ndarray/actions/workflows/test.yml/badge.svg?branch=main\n[test-url]: https://github.com/stdlib-js/ndarray/actions/workflows/test.yml?query=branch:main\n\n[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/ndarray/main.svg\n[coverage-url]: https://codecov.io/github/stdlib-js/ndarray?branch=main\n\n\u003c!--\n\n[dependencies-image]: https://img.shields.io/david/stdlib-js/ndarray.svg\n[dependencies-url]: https://david-dm.org/stdlib-js/ndarray/main\n\n--\u003e\n\n[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg\n[chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im\n\n[stdlib]: https://github.com/stdlib-js/stdlib\n\n[stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors\n\n[umd]: https://github.com/umdjs/umd\n[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules\n\n[deno-url]: https://github.com/stdlib-js/ndarray/tree/deno\n[deno-readme]: https://github.com/stdlib-js/ndarray/blob/deno/README.md\n[umd-url]: https://github.com/stdlib-js/ndarray/tree/umd\n[umd-readme]: https://github.com/stdlib-js/ndarray/blob/umd/README.md\n[esm-url]: https://github.com/stdlib-js/ndarray/tree/esm\n[esm-readme]: https://github.com/stdlib-js/ndarray/blob/esm/README.md\n[branches-url]: https://github.com/stdlib-js/ndarray/blob/main/branches.md\n\n[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/ndarray/main/LICENSE\n\n\u003c!-- \u003ctoc-links\u003e --\u003e\n\n[@stdlib/ndarray/at]: https://github.com/stdlib-js/ndarray/tree/main/at\n\n[@stdlib/ndarray/broadcast-array]: https://github.com/stdlib-js/ndarray/tree/main/broadcast-array\n\n[@stdlib/ndarray/broadcast-arrays]: https://github.com/stdlib-js/ndarray/tree/main/broadcast-arrays\n\n[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray/tree/main/casting-modes\n\n[@stdlib/ndarray/data-buffer]: https://github.com/stdlib-js/ndarray/tree/main/data-buffer\n\n[@stdlib/ndarray/defaults]: https://github.com/stdlib-js/ndarray/tree/main/defaults\n\n[@stdlib/ndarray/dispatch]: https://github.com/stdlib-js/ndarray/tree/main/dispatch\n\n[@stdlib/ndarray/dtype]: https://github.com/stdlib-js/ndarray/tree/main/dtype\n\n[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray/tree/main/dtypes\n\n[@stdlib/ndarray/empty-like]: https://github.com/stdlib-js/ndarray/tree/main/empty-like\n\n[@stdlib/ndarray/empty]: https://github.com/stdlib-js/ndarray/tree/main/empty\n\n[@stdlib/ndarray/fancy]: https://github.com/stdlib-js/ndarray/tree/main/fancy\n\n[@stdlib/ndarray/fill-by]: https://github.com/stdlib-js/ndarray/tree/main/fill-by\n\n[@stdlib/ndarray/fill]: https://github.com/stdlib-js/ndarray/tree/main/fill\n\n[@stdlib/ndarray/filter-map]: https://github.com/stdlib-js/ndarray/tree/main/filter-map\n\n[@stdlib/ndarray/filter]: https://github.com/stdlib-js/ndarray/tree/main/filter\n\n[@stdlib/ndarray/flag]: https://github.com/stdlib-js/ndarray/tree/main/flag\n\n[@stdlib/ndarray/flags]: https://github.com/stdlib-js/ndarray/tree/main/flags\n\n[@stdlib/ndarray/for-each]: https://github.com/stdlib-js/ndarray/tree/main/for-each\n\n[@stdlib/ndarray/from-scalar]: https://github.com/stdlib-js/ndarray/tree/main/from-scalar\n\n[@stdlib/ndarray/ind2sub]: https://github.com/stdlib-js/ndarray/tree/main/ind2sub\n\n[@stdlib/ndarray/index-modes]: https://github.com/stdlib-js/ndarray/tree/main/index-modes\n\n[@stdlib/ndarray/index]: https://github.com/stdlib-js/ndarray/tree/main/index\n\n[@stdlib/ndarray/map]: https://github.com/stdlib-js/ndarray/tree/main/map\n\n[@stdlib/ndarray/maybe-broadcast-array]: https://github.com/stdlib-js/ndarray/tree/main/maybe-broadcast-array\n\n[@stdlib/ndarray/maybe-broadcast-arrays]: https://github.com/stdlib-js/ndarray/tree/main/maybe-broadcast-arrays\n\n[@stdlib/ndarray/min-dtype]: https://github.com/stdlib-js/ndarray/tree/main/min-dtype\n\n[@stdlib/ndarray/mostly-safe-casts]: https://github.com/stdlib-js/ndarray/tree/main/mostly-safe-casts\n\n[@stdlib/ndarray/ndarraylike2ndarray]: https://github.com/stdlib-js/ndarray/tree/main/ndarraylike2ndarray\n\n[@stdlib/ndarray/ndims]: https://github.com/stdlib-js/ndarray/tree/main/ndims\n\n[@stdlib/ndarray/next-dtype]: https://github.com/stdlib-js/ndarray/tree/main/next-dtype\n\n[@stdlib/ndarray/numel-dimension]: https://github.com/stdlib-js/ndarray/tree/main/numel-dimension\n\n[@stdlib/ndarray/numel]: https://github.com/stdlib-js/ndarray/tree/main/numel\n\n[@stdlib/ndarray/offset]: https://github.com/stdlib-js/ndarray/tree/main/offset\n\n[@stdlib/ndarray/order]: https://github.com/stdlib-js/ndarray/tree/main/order\n\n[@stdlib/ndarray/orders]: https://github.com/stdlib-js/ndarray/tree/main/orders\n\n[@stdlib/ndarray/output-dtype-policies]: https://github.com/stdlib-js/ndarray/tree/main/output-dtype-policies\n\n[@stdlib/ndarray/promotion-rules]: https://github.com/stdlib-js/ndarray/tree/main/promotion-rules\n\n[@stdlib/ndarray/reject]: https://github.com/stdlib-js/ndarray/tree/main/reject\n\n[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray/tree/main/safe-casts\n\n[@stdlib/ndarray/same-kind-casts]: https://github.com/stdlib-js/ndarray/tree/main/same-kind-casts\n\n[@stdlib/ndarray/shape]: https://github.com/stdlib-js/ndarray/tree/main/shape\n\n[@stdlib/ndarray/slice-assign]: https://github.com/stdlib-js/ndarray/tree/main/slice-assign\n\n[@stdlib/ndarray/slice-dimension-from]: https://github.com/stdlib-js/ndarray/tree/main/slice-dimension-from\n\n[@stdlib/ndarray/slice-dimension-to]: https://github.com/stdlib-js/ndarray/tree/main/slice-dimension-to\n\n[@stdlib/ndarray/slice-dimension]: https://github.com/stdlib-js/ndarray/tree/main/slice-dimension\n\n[@stdlib/ndarray/slice-from]: https://github.com/stdlib-js/ndarray/tree/main/slice-from\n\n[@stdlib/ndarray/slice-to]: https://github.com/stdlib-js/ndarray/tree/main/slice-to\n\n[@stdlib/ndarray/slice]: https://github.com/stdlib-js/ndarray/tree/main/slice\n\n[@stdlib/ndarray/stride]: https://github.com/stdlib-js/ndarray/tree/main/stride\n\n[@stdlib/ndarray/strides]: https://github.com/stdlib-js/ndarray/tree/main/strides\n\n[@stdlib/ndarray/sub2ind]: https://github.com/stdlib-js/ndarray/tree/main/sub2ind\n\n[@stdlib/ndarray/to-array]: https://github.com/stdlib-js/ndarray/tree/main/to-array\n\n[@stdlib/ndarray/to-fancy]: https://github.com/stdlib-js/ndarray/tree/main/to-fancy\n\n[@stdlib/ndarray/to-json]: https://github.com/stdlib-js/ndarray/tree/main/to-json\n\n[@stdlib/ndarray/zeros-like]: https://github.com/stdlib-js/ndarray/tree/main/zeros-like\n\n[@stdlib/ndarray/zeros]: https://github.com/stdlib-js/ndarray/tree/main/zeros\n\n[@stdlib/ndarray/base]: https://github.com/stdlib-js/ndarray/tree/main/base\n\n[@stdlib/ndarray/iter]: https://github.com/stdlib-js/ndarray/tree/main/iter\n\n[@stdlib/ndarray/array]: https://github.com/stdlib-js/ndarray/tree/main/array\n\n[@stdlib/ndarray/ctor]: https://github.com/stdlib-js/ndarray/tree/main/ctor\n\n\u003c!-- \u003c/toc-links\u003e --\u003e\n\n\u003c/section\u003e\n\n\u003c!-- /.links --\u003e\n","funding_links":["https://github.com/sponsors/stdlib-js","https://opencollective.com/stdlib","https://tidelift.com/funding/github/npm/@stdlib/stdlib"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstdlib-js%2Fndarray","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstdlib-js%2Fndarray","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstdlib-js%2Fndarray/lists"}