time-to-botec/squiggle/node_modules/@stdlib/ndarray/base/assert/README.md

128 lines
7.1 KiB
Markdown
Raw Normal View History

<!--
@license Apache-2.0
Copyright (c) 2018 The Stdlib Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
# Assert
> Base ndarray assertion utilities.
<section class="usage">
## Usage
```javascript
var ns = require( '@stdlib/ndarray/base/assert' );
```
#### ns
Base ndarray assertion utilities.
```javascript
var o = ns;
// returns {...}
```
<!-- <toc pattern="*"> -->
<div class="namespace-toc">
- <span class="signature">[`isAllowedDataTypeCast( from, to, casting )`][@stdlib/ndarray/base/assert/is-allowed-data-type-cast]</span><span class="delimiter">: </span><span class="description">determine whether an ndarray data type can be cast to another ndarray data type according to a specified casting mode.</span>
- <span class="signature">[`isBufferLengthCompatibleShape( len, shape )`][@stdlib/ndarray/base/assert/is-buffer-length-compatible-shape]</span><span class="delimiter">: </span><span class="description">determine if a buffer length is compatible with an array shape.</span>
- <span class="signature">[`isBufferLengthCompatible( len, shape, strides, offset )`][@stdlib/ndarray/base/assert/is-buffer-length-compatible]</span><span class="delimiter">: </span><span class="description">determine if a buffer length is compatible with ndarray meta data.</span>
- <span class="signature">[`isCastingMode( value )`][@stdlib/ndarray/base/assert/is-casting-mode]</span><span class="delimiter">: </span><span class="description">test if an input value is a supported ndarray casting mode.</span>
- <span class="signature">[`isColumnMajorContiguous( shape, strides, offset )`][@stdlib/ndarray/base/assert/is-column-major-contiguous]</span><span class="delimiter">: </span><span class="description">determine if an array is column-major contiguous.</span>
- <span class="signature">[`isColumnMajor( strides )`][@stdlib/ndarray/base/assert/is-column-major]</span><span class="delimiter">: </span><span class="description">given a stride array, determine whether an array is column-major.</span>
- <span class="signature">[`isContiguous( shape, strides, offset )`][@stdlib/ndarray/base/assert/is-contiguous]</span><span class="delimiter">: </span><span class="description">determine if an array is contiguous.</span>
- <span class="signature">[`isDataType( value )`][@stdlib/ndarray/base/assert/is-data-type]</span><span class="delimiter">: </span><span class="description">test if an input value is a supported ndarray data type.</span>
- <span class="signature">[`isIndexMode( value )`][@stdlib/ndarray/base/assert/is-index-mode]</span><span class="delimiter">: </span><span class="description">test if an input value is a supported ndarray index mode.</span>
- <span class="signature">[`isOrder( value )`][@stdlib/ndarray/base/assert/is-order]</span><span class="delimiter">: </span><span class="description">test if an input value is an ndarray order.</span>
- <span class="signature">[`isRowMajorContiguous( shape, strides, offset )`][@stdlib/ndarray/base/assert/is-row-major-contiguous]</span><span class="delimiter">: </span><span class="description">determine if an array is row-major contiguous.</span>
- <span class="signature">[`isRowMajor( strides )`][@stdlib/ndarray/base/assert/is-row-major]</span><span class="delimiter">: </span><span class="description">given a stride array, determine whether an array is row-major.</span>
- <span class="signature">[`isSafeDataTypeCast( from, to )`][@stdlib/ndarray/base/assert/is-safe-data-type-cast]</span><span class="delimiter">: </span><span class="description">determine whether an ndarray data type can be safely cast to another ndarray data type.</span>
- <span class="signature">[`isSameKindDataTypeCast( from, to )`][@stdlib/ndarray/base/assert/is-same-kind-data-type-cast]</span><span class="delimiter">: </span><span class="description">determine whether an ndarray data type can be safely cast to, or is of the same "kind" as, another ndarray data type.</span>
- <span class="signature">[`isSingleSegmentCompatible( shape, strides, offset )`][@stdlib/ndarray/base/assert/is-single-segment-compatible]</span><span class="delimiter">: </span><span class="description">determine if an array is compatible with a single memory segment.</span>
</div>
<!-- </toc> -->
</section>
<!-- /.usage -->
<section class="examples">
## Examples
<!-- TODO: better examples -->
<!-- eslint no-undef: "error" -->
```javascript
var objectKeys = require( '@stdlib/utils/keys' );
var ns = require( '@stdlib/ndarray/base/assert' );
console.log( objectKeys( ns ) );
```
</section>
<!-- /.examples -->
<section class="links">
<!-- <toc-links> -->
[@stdlib/ndarray/base/assert/is-allowed-data-type-cast]: https://www.npmjs.com/package/@stdlib/ndarray/tree/main/base/assert/is-allowed-data-type-cast
[@stdlib/ndarray/base/assert/is-buffer-length-compatible-shape]: https://www.npmjs.com/package/@stdlib/ndarray/tree/main/base/assert/is-buffer-length-compatible-shape
[@stdlib/ndarray/base/assert/is-buffer-length-compatible]: https://www.npmjs.com/package/@stdlib/ndarray/tree/main/base/assert/is-buffer-length-compatible
[@stdlib/ndarray/base/assert/is-casting-mode]: https://www.npmjs.com/package/@stdlib/ndarray/tree/main/base/assert/is-casting-mode
[@stdlib/ndarray/base/assert/is-column-major-contiguous]: https://www.npmjs.com/package/@stdlib/ndarray/tree/main/base/assert/is-column-major-contiguous
[@stdlib/ndarray/base/assert/is-column-major]: https://www.npmjs.com/package/@stdlib/ndarray/tree/main/base/assert/is-column-major
[@stdlib/ndarray/base/assert/is-contiguous]: https://www.npmjs.com/package/@stdlib/ndarray/tree/main/base/assert/is-contiguous
[@stdlib/ndarray/base/assert/is-data-type]: https://www.npmjs.com/package/@stdlib/ndarray/tree/main/base/assert/is-data-type
[@stdlib/ndarray/base/assert/is-index-mode]: https://www.npmjs.com/package/@stdlib/ndarray/tree/main/base/assert/is-index-mode
[@stdlib/ndarray/base/assert/is-order]: https://www.npmjs.com/package/@stdlib/ndarray/tree/main/base/assert/is-order
[@stdlib/ndarray/base/assert/is-row-major-contiguous]: https://www.npmjs.com/package/@stdlib/ndarray/tree/main/base/assert/is-row-major-contiguous
[@stdlib/ndarray/base/assert/is-row-major]: https://www.npmjs.com/package/@stdlib/ndarray/tree/main/base/assert/is-row-major
[@stdlib/ndarray/base/assert/is-safe-data-type-cast]: https://www.npmjs.com/package/@stdlib/ndarray/tree/main/base/assert/is-safe-data-type-cast
[@stdlib/ndarray/base/assert/is-same-kind-data-type-cast]: https://www.npmjs.com/package/@stdlib/ndarray/tree/main/base/assert/is-same-kind-data-type-cast
[@stdlib/ndarray/base/assert/is-single-segment-compatible]: https://www.npmjs.com/package/@stdlib/ndarray/tree/main/base/assert/is-single-segment-compatible
<!-- </toc-links> -->
</section>
<!-- /.links -->