diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 1ebf216..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-06-01T01:26:58.103Z diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ad3a3e0..b1d4bb8 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -94,6 +94,10 @@ jobs: # Replace branch in README.md link definitions for badges with the new version: find . -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/branch([=:])[^ ]+/branch\1v${NEW_VERSION}/g" + # Rewrite CHANGELOG.md to replace "Unreleased" with the new version: + sed -Ei "s/Unreleased/${NEW_VERSION}/g" CHANGELOG.md + sed -Ei "s/unreleased/v${NEW_VERSION}/g" CHANGELOG.md + # Create a new commit and tag: git add package.json README.md git commit -m "Release v${NEW_VERSION}" diff --git a/CHANGELOG.md b/CHANGELOG.md index d99d35a..fd09080 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,4 +2,95 @@ > Package changelog. -See [GitHub Releases](https://github.com/stdlib-js/ndarray-orders/releases) for the changelog. \ No newline at end of file +
+ +## Unreleased (2024-06-09) + +
+ +### Commits + +
+ +- [`539fc72`](https://github.com/stdlib-js/stdlib/commit/539fc725d1fea6738862de98e3f3c6385fbdc0e6) - **style:** fix indentation _(by Athan Reines)_ +- [`71b0621`](https://github.com/stdlib-js/stdlib/commit/71b06218afbce673efa51c4704f26637a27a1d1c) - **refactor:** ensure enumeration constants match BLAS layouts _(by Athan Reines)_ + +
+ +
+ + + +
+ +### Contributors + +A total of 1 person contributed to this release. Thank you to this contributor: + +- Athan Reines + +
+ + + +
+ + + +
+ +## 0.2.1 (2024-02-22) + +
+ +### Features + +- [`7ae5741`](https://github.com/stdlib-js/stdlib/commit/7ae574143c9716c82cea6cbf839a20b70a9cdfe0) - update minimum TypeScript version + +
+ + + +
+ +### 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 + + - To migrate, users should upgrade their TypeScript version to at least version 4.1. + +
+ + + +
+ +### Commits + +
+ +- [`7ae5741`](https://github.com/stdlib-js/stdlib/commit/7ae574143c9716c82cea6cbf839a20b70a9cdfe0) - **feat:** update minimum TypeScript version _(by Philipp Burckhardt)_ + +
+ +
+ + + +
+ +### Contributors + +A total of 1 person contributed to this release. Thank you to this contributor: + +- Philipp Burckhardt + +
+ + + +
+ + + diff --git a/README.md b/README.md index 17d640e..efe788f 100644 --- a/README.md +++ b/README.md @@ -79,10 +79,10 @@ Returns a list of ndarray orders. ```javascript var out = orders(); -// returns [ 'row-major', 'column-major' ] +// e.g., returns [ 'row-major', 'column-major' ] ``` -The output `array` contains the following orders: +The output array contains the following orders: - `row-major`: row-major (C-style) order. - `column-major`: column-major (Fortran-style) order. @@ -108,20 +108,12 @@ The output `array` contains the following orders: ```javascript -var indexOf = require( '@stdlib/utils-index-of' ); +var contains = require( '@stdlib/array-base-assert-contains' ).factory; var orders = require( '@stdlib/ndarray-orders' ); -var ORDERS = orders(); -var bool; +var isOrder = contains( orders() ); -function isOrder( str ) { - if ( indexOf( ORDERS, str ) === -1 ) { - return false; - } - return true; -} - -bool = isOrder( 'row-major' ); +var bool = isOrder( 'row-major' ); // returns true bool = isOrder( 'column-major' ); diff --git a/dist/index.js b/dist/index.js index bfd1f07..4abe0d0 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,8 +1,8 @@ -"use strict";var e=function(s,r){return function(){return r||s((r={exports:{}}).exports,r),r.exports}};var t=e(function(p,m){m.exports=["row-major","column-major"]});var o=e(function(x,u){ -var c=t();function j(){return c.slice()}u.exports=j -});var a=e(function(R,n){ -function l(){return{"row-major":1,"column-major":2}}n.exports=l -});var q=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),i=o(),v=a();q(i,"enum",v);module.exports=i; +"use strict";var e=function(s,r){return function(){return r||s((r={exports:{}}).exports,r),r.exports}};var o=e(function(x,c){c.exports=["row-major","column-major"]});var a=e(function(O,u){ +var j=o();function l(){return j.slice()}u.exports=l +});var m=e(function(R,n){ +var v=require('@stdlib/blas-base-layouts/dist').enum,t=v();function q(){return{"row-major":t["row-major"],"column-major":t["column-major"]}}n.exports=q +});var d=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),i=a(),p=m();d(i,"enum",p);module.exports=i; /** @license Apache-2.0 */ /** @license Apache-2.0 */ //# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map index fca7adc..540fce9 100644 --- a/dist/index.js.map +++ b/dist/index.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../lib/orders.json", "../lib/main.js", "../lib/enum.js", "../lib/index.js"], - "sourcesContent": ["[\n\t\"row-major\",\n\t\"column-major\"\n]\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar ORDERS = require( './orders.json' );\n\n\n// MAIN //\n\n/**\n* Returns a list of ndarray orders.\n*\n* @returns {StringArray} list of ndarray orders\n*\n* @example\n* var list = orders();\n* // returns [ 'row-major', 'column-major' ]\n*/\nfunction orders() {\n\treturn ORDERS.slice();\n}\n\n\n// EXPORTS //\n\nmodule.exports = orders;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Returns an object mapping supported orders to integer values for purposes of C inter-operation.\n*\n* ## Notes\n*\n* - Downstream consumers of this mapping should **not** rely on specific integer values (e.g., `row-major == 1`). Instead, the object should be used in an opaque manner.\n* - The main purpose of this function is JavaScript and C inter-operation of ndarray objects.\n*\n* @returns {Object} object mapping supported orders to integer values\n*\n* @example\n* var table = enumerated();\n* // returns \n*/\nfunction enumerated() {\n\t// NOTE: the following should match the C `orders.h` enumeration!!!!\n\treturn {\n\t\t// Row-major (C-style):\n\t\t'row-major': 1,\n\n\t\t// Column-major (Fortran-style):\n\t\t'column-major': 2\n\t};\n}\n\n\n// EXPORTS //\n\nmodule.exports = enumerated;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Return a list of ndarray orders.\n*\n* @module @stdlib/ndarray-orders\n*\n* @example\n* var orders = require( '@stdlib/ndarray-orders' );\n*\n* var list = orders();\n* // returns [ 'row-major', 'column-major' ]\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar enumeration = require( './enum.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'enum', enumeration );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,CAAAA,EAAA,SACC,YACA,cACD,ICHA,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,IAcb,SAASC,GAAS,CACjB,OAAOD,EAAO,MAAM,CACrB,CAKAD,EAAO,QAAUE,IC3CjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAoCA,SAASC,GAAa,CAErB,MAAO,CAEN,YAAa,EAGb,eAAgB,CACjB,CACD,CAKAD,EAAO,QAAUC,IChBjB,IAAIC,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAc,IAKlBF,EAAaC,EAAM,OAAQC,CAAY,EAKvC,OAAO,QAAUD", - "names": ["require_orders", "__commonJSMin", "exports", "module", "require_main", "__commonJSMin", "exports", "module", "ORDERS", "orders", "require_enum", "__commonJSMin", "exports", "module", "enumerated", "setReadOnly", "main", "enumeration"] + "sourcesContent": ["[\n\t\"row-major\",\n\t\"column-major\"\n]\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar ORDERS = require( './orders.json' );\n\n\n// MAIN //\n\n/**\n* Returns a list of ndarray orders.\n*\n* @returns {StringArray} list of ndarray orders\n*\n* @example\n* var list = orders();\n* // e.g., returns [ 'row-major', 'column-major' ]\n*/\nfunction orders() {\n\treturn ORDERS.slice();\n}\n\n\n// EXPORTS //\n\nmodule.exports = orders;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar layouts = require( '@stdlib/blas-base-layouts' ).enum;\n\n\n// VARIABLES //\n\nvar LAYOUTS = layouts();\n\n\n// MAIN //\n\n/**\n* Returns an object mapping supported orders to integer values for purposes of C inter-operation.\n*\n* ## Notes\n*\n* - Downstream consumers of this mapping should **not** rely on specific integer values (e.g., `row-major == 1`). Instead, the object should be used in an opaque manner.\n* - The main purpose of this function is JavaScript and C inter-operation of ndarray objects.\n*\n* @returns {Object} object mapping supported orders to integer values\n*\n* @example\n* var table = enumerated();\n* // returns \n*/\nfunction enumerated() {\n\t// NOTE: the following should match the C `orders.h` enumeration!!!!\n\treturn {\n\t\t// Row-major (C-style):\n\t\t'row-major': LAYOUTS[ 'row-major' ],\n\n\t\t// Column-major (Fortran-style):\n\t\t'column-major': LAYOUTS[ 'column-major' ]\n\t};\n}\n\n\n// EXPORTS //\n\nmodule.exports = enumerated;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Return a list of ndarray orders.\n*\n* @module @stdlib/ndarray-orders\n*\n* @example\n* var orders = require( '@stdlib/ndarray-orders' );\n*\n* var list = orders();\n* // e.g., returns [ 'row-major', 'column-major' ]\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar enumeration = require( './enum.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'enum', enumeration );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], + "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,CAAAA,EAAA,SACC,YACA,cACD,ICHA,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,IAcb,SAASC,GAAS,CACjB,OAAOD,EAAO,MAAM,CACrB,CAKAD,EAAO,QAAUE,IC3CjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAU,QAAS,2BAA4B,EAAE,KAKjDC,EAAUD,EAAQ,EAmBtB,SAASE,GAAa,CAErB,MAAO,CAEN,YAAaD,EAAS,WAAY,EAGlC,eAAgBA,EAAS,cAAe,CACzC,CACD,CAKAF,EAAO,QAAUG,IC1BjB,IAAIC,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAc,IAKlBF,EAAaC,EAAM,OAAQC,CAAY,EAKvC,OAAO,QAAUD", + "names": ["require_orders", "__commonJSMin", "exports", "module", "require_main", "__commonJSMin", "exports", "module", "ORDERS", "orders", "require_enum", "__commonJSMin", "exports", "module", "layouts", "LAYOUTS", "enumerated", "setReadOnly", "main", "enumeration"] } diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts index 7d72b43..6e9af37 100644 --- a/docs/types/index.d.ts +++ b/docs/types/index.d.ts @@ -32,7 +32,7 @@ * * @example * var list = orders(); -* // returns [ 'row-major', 'column-major' ] +* // e.g., returns [ 'row-major', 'column-major' ] */ declare function orders(): Array; diff --git a/examples/index.js b/examples/index.js index 9a69767..fee9c70 100644 --- a/examples/index.js +++ b/examples/index.js @@ -18,20 +18,12 @@ 'use strict'; -var indexOf = require( '@stdlib/utils-index-of' ); +var contains = require( '@stdlib/array-base-assert-contains' ).factory; var orders = require( './../lib' ); -var ORDERS = orders(); -var bool; +var isOrder = contains( orders() ); -function isOrder( str ) { - if ( indexOf( ORDERS, str ) === -1 ) { - return false; - } - return true; -} - -bool = isOrder( 'row-major' ); +var bool = isOrder( 'row-major' ); console.log( bool ); // => true diff --git a/include/stdlib/ndarray/orders.h b/include/stdlib/ndarray/orders.h index 1c6dff5..e9ee535 100644 --- a/include/stdlib/ndarray/orders.h +++ b/include/stdlib/ndarray/orders.h @@ -19,15 +19,17 @@ #ifndef STDLIB_NDARRAY_ORDERS_H #define STDLIB_NDARRAY_ORDERS_H +#include "stdlib/blas/base/layouts.h" + /** * Enumeration of ndarray orders (i.e., memory layout/iteration order). */ enum STDLIB_NDARRAY_ORDER { // Row-major (C-style): - STDLIB_NDARRAY_ROW_MAJOR = 1, + STDLIB_NDARRAY_ROW_MAJOR = STDLIB_BLAS_ROW_MAJOR, // Column-major (Fortran-style): - STDLIB_NDARRAY_COLUMN_MAJOR = 2 + STDLIB_NDARRAY_COLUMN_MAJOR = STDLIB_BLAS_COLUMN_MAJOR }; #endif // !STDLIB_NDARRAY_ORDERS_H diff --git a/lib/enum.js b/lib/enum.js index a36bc52..d721d04 100644 --- a/lib/enum.js +++ b/lib/enum.js @@ -18,6 +18,16 @@ 'use strict'; +// MODULES // + +var layouts = require( '@stdlib/blas-base-layouts' ).enum; + + +// VARIABLES // + +var LAYOUTS = layouts(); + + // MAIN // /** @@ -38,10 +48,10 @@ function enumerated() { // NOTE: the following should match the C `orders.h` enumeration!!!! return { // Row-major (C-style): - 'row-major': 1, + 'row-major': LAYOUTS[ 'row-major' ], // Column-major (Fortran-style): - 'column-major': 2 + 'column-major': LAYOUTS[ 'column-major' ] }; } diff --git a/lib/index.js b/lib/index.js index 21524fb..dcaece7 100644 --- a/lib/index.js +++ b/lib/index.js @@ -27,7 +27,7 @@ * var orders = require( '@stdlib/ndarray-orders' ); * * var list = orders(); -* // returns [ 'row-major', 'column-major' ] +* // e.g., returns [ 'row-major', 'column-major' ] */ // MODULES // diff --git a/lib/main.js b/lib/main.js index f644b18..b8c619b 100644 --- a/lib/main.js +++ b/lib/main.js @@ -32,7 +32,7 @@ var ORDERS = require( './orders.json' ); * * @example * var list = orders(); -* // returns [ 'row-major', 'column-major' ] +* // e.g., returns [ 'row-major', 'column-major' ] */ function orders() { return ORDERS.slice(); diff --git a/manifest.json b/manifest.json index f95ad49..4164720 100644 --- a/manifest.json +++ b/manifest.json @@ -1,36 +1,38 @@ { - "options": {}, - "fields": [ - { - "field": "src", - "resolve": true, - "relative": true - }, - { - "field": "include", - "resolve": true, - "relative": true - }, - { - "field": "libraries", - "resolve": false, - "relative": false - }, - { - "field": "libpath", - "resolve": true, - "relative": false - } - ], - "confs": [ - { - "src": [], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [] - } - ] + "options": {}, + "fields": [ + { + "field": "src", + "resolve": true, + "relative": true + }, + { + "field": "include", + "resolve": true, + "relative": true + }, + { + "field": "libraries", + "resolve": false, + "relative": false + }, + { + "field": "libpath", + "resolve": true, + "relative": false + } + ], + "confs": [ + { + "src": [], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas-base-layouts" + ] + } + ] } diff --git a/package.json b/package.json index 34c04af..cda702c 100644 --- a/package.json +++ b/package.json @@ -38,14 +38,15 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { + "@stdlib/blas-base-layouts": "github:stdlib-js/blas-base-layouts#main", "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1", "@stdlib/utils-library-manifest": "^0.2.1" }, "devDependencies": { + "@stdlib/array-base-assert-contains": "^0.2.1", "@stdlib/assert-has-own-property": "^0.2.1", "@stdlib/assert-is-nonnegative-integer": "^0.2.1", "@stdlib/assert-is-string-array": "^0.2.1", - "@stdlib/utils-index-of": "^0.2.1", "tape": "git+https://github.com/kgryte/tape.git#fix/globby", "istanbul": "^0.4.1", "tap-min": "git+https://github.com/Planeshifter/tap-min.git",