diff --git a/.github/.keepalive b/.github/.keepalive new file mode 100644 index 0000000..115b3dd --- /dev/null +++ b/.github/.keepalive @@ -0,0 +1 @@ +2024-08-01T04:02:00.100Z diff --git a/.gitignore b/.gitignore index 49b206b..4fdc97c 100644 --- a/.gitignore +++ b/.gitignore @@ -101,6 +101,8 @@ docs/**/node_modules/ pids *.pid *.seed +yarn.lock +package-lock.json # Typescript # ############## diff --git a/CHANGELOG.md b/CHANGELOG.md index 92d2b23..6bcb7f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,29 +2,9 @@ > Package changelog. -
- -## 0.2.0 (2024-07-28) - -No changes reported for this release. - -
- - - -
+
-## 0.1.1 (2024-02-24) - -No changes reported for this release. - -
- - - -
- -## 0.2.0 (2024-02-14) +## Unreleased (2024-08-01)
@@ -32,7 +12,7 @@ No changes reported for this release.
-- [`453dd85`](https://github.com/stdlib-js/stdlib/commit/453dd85b5dd186d2b4d458256fe84906e1503fe2) - **build:** remove tslint directives _(by Philipp Burckhardt)_ +- [`22c4d29`](https://github.com/stdlib-js/stdlib/commit/22c4d29898e2b5bb4cb071a6b7f62536027eaf28) - **docs:** remove blank line _(by Athan Reines)_
@@ -46,7 +26,7 @@ No changes reported for this release. A total of 1 person contributed to this release. Thank you to this contributor: -- Philipp Burckhardt +- Athan Reines
@@ -56,58 +36,41 @@ A total of 1 person contributed to this release. Thank you to this contributor: -
- -## 0.1.0 (2023-09-23) +
-
+## 0.2.1 (2024-07-28) -### Features - -- [`7ae5741`](https://github.com/stdlib-js/stdlib/commit/7ae574143c9716c82cea6cbf839a20b70a9cdfe0) - update minimum TypeScript version +No changes reported for this release.
- - -
+ -### BREAKING CHANGES +
-- [`7ae5741`](https://github.com/stdlib-js/stdlib/commit/7ae574143c9716c82cea6cbf839a20b70a9cdfe0): update minimum TypeScript version -- [`7ae5741`](https://github.com/stdlib-js/stdlib/commit/7ae574143c9716c82cea6cbf839a20b70a9cdfe0): update minimum TypeScript version to 4.1 +## 0.1.1 (2024-02-24) - - To migrate, users should upgrade their TypeScript version to at least version 4.1. +No changes reported for this release.
- - -
- -### Commits + -
+
-- [`7ae5741`](https://github.com/stdlib-js/stdlib/commit/7ae574143c9716c82cea6cbf839a20b70a9cdfe0) - **feat:** update minimum TypeScript version _(by Philipp Burckhardt)_ +## 0.2.0 (2024-02-14) -
+No changes reported for this release.
- - -
- -### Contributors - -A total of 1 person contributed to this release. Thank you to this contributor: + -- Philipp Burckhardt +
-
+## 0.1.0 (2023-09-23) - +No changes reported for this release.
diff --git a/README.md b/README.md index 70a4a69..8f48478 100644 --- a/README.md +++ b/README.md @@ -196,11 +196,6 @@ For more information on the project, filing bug reports and feature requests, an --- -## License - -See [LICENSE][stdlib-license]. - - ## Copyright Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. @@ -216,11 +211,11 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. [npm-image]: http://img.shields.io/npm/v/@stdlib/ndarray-base-assert-is-row-major-contiguous.svg [npm-url]: https://npmjs.org/package/@stdlib/ndarray-base-assert-is-row-major-contiguous -[test-image]: https://github.com/stdlib-js/ndarray-base-assert-is-row-major-contiguous/actions/workflows/test.yml/badge.svg?branch=v0.2.1 -[test-url]: https://github.com/stdlib-js/ndarray-base-assert-is-row-major-contiguous/actions/workflows/test.yml?query=branch:v0.2.1 +[test-image]: https://github.com/stdlib-js/ndarray-base-assert-is-row-major-contiguous/actions/workflows/test.yml/badge.svg?branch=main +[test-url]: https://github.com/stdlib-js/ndarray-base-assert-is-row-major-contiguous/actions/workflows/test.yml?query=branch:main [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/ndarray-base-assert-is-row-major-contiguous/main.svg -[coverage-url]: https://codecov.io/github/stdlib-js/ndarray-base-assert-is-row-major-contiguous?branch=v0.2.1 +[coverage-url]: https://codecov.io/github/stdlib-js/ndarray-base-assert-is-row-major-contiguous?branch=main diff --git a/benchmark/c/benchmark.c b/benchmark/c/benchmark.c index 8df7af6..d647a46 100644 --- a/benchmark/c/benchmark.c +++ b/benchmark/c/benchmark.c @@ -16,9 +16,6 @@ * limitations under the License. */ -/** -* Benchmark `is_row_major_contiguous`. -*/ #include "stdlib/ndarray/base/assert/is_row_major_contiguous.h" #include "stdlib/ndarray/dtypes.h" #include @@ -35,7 +32,7 @@ /** * Prints the TAP version. */ -void print_version() { +static void print_version( void ) { printf( "TAP version 13\n" ); } @@ -45,7 +42,7 @@ void print_version() { * @param total total number of tests * @param passing total number of passing tests */ -void print_summary( int total, int passing ) { +static void print_summary( int total, int passing ) { printf( "#\n" ); printf( "1..%d\n", total ); // TAP plan printf( "# total %d\n", total ); @@ -59,7 +56,7 @@ void print_summary( int total, int passing ) { * * @param elapsed elapsed time in seconds */ -void print_results( double elapsed ) { +static void print_results( double elapsed ) { double rate = (double)ITERATIONS / elapsed; printf( " ---\n" ); printf( " iterations: %d\n", ITERATIONS ); @@ -73,18 +70,18 @@ void print_results( double elapsed ) { * * @return clock time */ -double tic() { +static double tic( void ) { struct timeval now; gettimeofday( &now, NULL ); return (double)now.tv_sec + (double)now.tv_usec/1.0e6; } /** -* Generates a random double on the interval [0,1]. +* Generates a random number on the interval [0,1). * -* @return random double +* @return random number */ -double rand_double() { +static double rand_double( void ) { int r = rand(); return (double)r / ( (double)RAND_MAX + 1.0 ); } @@ -94,7 +91,7 @@ double rand_double() { * * @return elapsed time in seconds */ -double benchmark() { +static double benchmark( void ) { double elapsed; int8_t b; double t; diff --git a/dist/index.js b/dist/index.js index da3e786..0716978 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,5 +1,48 @@ -"use strict";var u=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var o=u(function(g,i){ -var a=require('@stdlib/ndarray-base-assert-is-single-segment-compatible/dist'),n=require('@stdlib/ndarray-base-iteration-order/dist'),s=require('@stdlib/ndarray-base-assert-is-row-major/dist');function q(e,r,t){return n(r)!==0&&s(r)&&a(e,r,t)}i.exports=q -});var v=o();module.exports=v; /** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map + +'use strict'; + +/** +* Determine if an array is row-major contiguous. +* +* @module @stdlib/ndarray-base-assert-is-row-major-contiguous +* +* @example +* var isRowMajorContiguous = require( '@stdlib/ndarray-base-assert-is-row-major-contiguous' ); +* +* var shape = [ 2, 2 ]; +* var strides = [ 2, 1 ]; +* var offset = 0; +* +* var bool = isRowMajorContiguous( shape, strides, offset ); +* // returns true +* +* @example +* var isRowMajorContiguous = require( '@stdlib/ndarray-base-assert-is-row-major-contiguous' ); +* +* var shape = [ 2, 2 ]; +* var strides = [ -2, 1 ]; +* var offset = 2; +* +* var bool = isRowMajorContiguous( shape, strides, offset ); +* // returns false +* +* @example +* var isRowMajorContiguous = require( '@stdlib/ndarray-base-assert-is-row-major-contiguous' ); +* +* var shape = [ 2, 2 ]; +* var strides = [ 2, 2 ]; +* var offset = 0; +* +* var bool = isRowMajorContiguous( shape, strides, offset ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/dist/main.js b/dist/main.js new file mode 100644 index 0000000..04855ca --- /dev/null +++ b/dist/main.js @@ -0,0 +1,73 @@ +/** +* @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. +*/ + +'use strict'; + +// MODULES // + +var isSingleSegmentCompatible = require( '@stdlib/ndarray-base-assert-is-single-segment-compatible' ); +var iterationOrder = require( '@stdlib/ndarray-base-iteration-order' ); +var isRowMajor = require( '@stdlib/ndarray-base-assert-is-row-major' ); + + +// MAIN // + +/** +* Returns a boolean indicating if an array is row-major contiguous. +* +* @param {NonNegativeIntegerArray} shape - array shape +* @param {IntegerArray} strides - stride array +* @param {NonNegativeInteger} offset - index offset +* @returns {boolean} boolean indicating if an array is row-major contiguous +* +* @example +* var shape = [ 2, 2 ]; +* var strides = [ 2, 1 ]; +* var offset = 0; +* +* var bool = isRowMajorContiguous( shape, strides, offset ); +* // returns true +* +* @example +* var shape = [ 2, 2 ]; +* var strides = [ -2, 1 ]; +* var offset = 2; +* +* var bool = isRowMajorContiguous( shape, strides, offset ); +* // returns false +* +* @example +* var shape = [ 2, 2 ]; +* var strides = [ 2, 2 ]; +* var offset = 0; +* +* var bool = isRowMajorContiguous( shape, strides, offset ); +* // returns false +*/ +function isRowMajorContiguous( shape, strides, offset ) { + return ( + iterationOrder( strides ) !== 0 && + isRowMajor( strides ) && + isSingleSegmentCompatible( shape, strides, offset ) + ); +} + + +// EXPORTS // + +module.exports = isRowMajorContiguous;