diff --git a/.editorconfig b/.editorconfig index 0779e8a..dab5d2a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -86,7 +86,6 @@ indent_style = tab [*.{f,f.txt}] indent_style = space indent_size = 2 -insert_final_newline = false # Set properties for shell files: [*.{sh,sh.txt}] diff --git a/CHANGELOG.md b/CHANGELOG.md index 95ac9e5..d886223 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@
-## Unreleased (2024-12-23) +## Unreleased (2025-02-11)
@@ -22,6 +22,7 @@
+- [`4bc7b8c`](https://github.com/stdlib-js/stdlib/commit/4bc7b8cf8b26105f6a02decbe7030022024070df) - **docs:** update `blas/ext/base/dcusumpw` to follow current project conventions [(#5170)](https://github.com/stdlib-js/stdlib/pull/5170) _(by Muhammad Haris)_ - [`62364f6`](https://github.com/stdlib-js/stdlib/commit/62364f62ea823a3b52c2ad25660ecd80c71f8f36) - **style:** fix C comment alignment _(by Philipp Burckhardt)_ - [`6a0d6b8`](https://github.com/stdlib-js/stdlib/commit/6a0d6b861f8e2079a501ca4e46a9175440eedb46) - **style:** update to use tabs for indentation _(by Philipp Burckhardt)_ - [`3bd3f48`](https://github.com/stdlib-js/stdlib/commit/3bd3f480c66a81bc012efd838cef6e0cbda52870) - **feat:** add C `ndarray` API and refactor `blas/ext/base/dcusumpw` [(#2981)](https://github.com/stdlib-js/stdlib/pull/2981) _(by Muhammad Haris, Athan Reines)_ diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 173c07b..d1062b3 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -27,6 +27,8 @@ Daniel Killenberger Daniel Yu <40680511+Daniel777y@users.noreply.github.com> Debashis Maharana Desh Deepak Kant <118960904+DeshDeepakKant@users.noreply.github.com> +Dev Goel <135586571+corsairier@users.noreply.github.com> +Dhruv Arvind Singh <154677013+DhruvArvindSingh@users.noreply.github.com> Divyansh Seth <59174836+sethdivyansh@users.noreply.github.com> Dominic Lim <46486515+domlimm@users.noreply.github.com> Dominik Moritz @@ -35,7 +37,7 @@ EuniceSim142 <77243938+EuniceSim142@users.noreply.github.com> Frank Kovacs Golden Kumar <103646877+AuenKr@users.noreply.github.com> Gunj Joshi -Gururaj Gurram <143020143+gururaj1512@users.noreply.github.com> +Gururaj Gurram HarshaNP <96897754+GittyHarsha@users.noreply.github.com> Harshita Kalani Hridyanshu <124202756+HRIDYANSHU054@users.noreply.github.com> @@ -49,6 +51,7 @@ Joey Reed Jordan Gallivan <115050475+Jordan-Gallivan@users.noreply.github.com> Joris Labie Justin Dennison +Karan Anand <119553199+anandkaranubc@users.noreply.github.com> Karthik Prakash <116057817+skoriop@users.noreply.github.com> Kohantika Nath <145763549+kohantikanath@users.noreply.github.com> Krishnendu Das <86651039+itskdhere@users.noreply.github.com> @@ -60,6 +63,7 @@ Marcus Fantham Matt Cochrane Mihir Pandit <129577900+MSP20086@users.noreply.github.com> Milan Raj +Mohammad Bin Aftab <48010758+MohammadBinAftab@users.noreply.github.com> Mohammad Kaif Momtchil Momtchev Muhammad Haris @@ -117,10 +121,12 @@ UtkershBasnet <119008923+UtkershBasnet@users.noreply.github.com> Vaibhav Patel <98279986+noobCoderVP@users.noreply.github.com> Varad Gupta Vinit Pandit <106718914+MeastroZI@users.noreply.github.com> -Vivek maurya <155618190+vivekmaurya001@users.noreply.github.com> +Vivek Maurya Xiaochuan Ye Yaswanth Kosuru <116426380+yaswanthkosuru@users.noreply.github.com> Yernar Yergaziyev +ekambains olenkabilonizhka <62379231+olenkabilonizhka@users.noreply.github.com> +pranav-1720 <123018993+pranav-1720@users.noreply.github.com> rainn <88160429+AmCodesLame@users.noreply.github.com> rei2hu diff --git a/NOTICE b/NOTICE index e6e7482..cbd3a29 100644 --- a/NOTICE +++ b/NOTICE @@ -1 +1 @@ -Copyright (c) 2016-2024 The Stdlib Authors. +Copyright (c) 2016-2025 The Stdlib Authors. diff --git a/README.md b/README.md index efe9f02..bbbf9a7 100644 --- a/README.md +++ b/README.md @@ -94,11 +94,11 @@ The function has the following parameters: - **N**: number of indexed elements. - **sum**: initial sum. - **x**: input [`Float64Array`][@stdlib/array/float64]. -- **strideX**: index increment for `x`. +- **strideX**: stride length for `x`. - **y**: output [`Float64Array`][@stdlib/array/float64]. -- **strideY**: index increment for `y`. +- **strideY**: stride length for `y`. -The `N` and stride parameters determine which elements in the strided arrays are accessed at runtime. For example, to compute the cumulative sum of every other element in the strided input array, +The `N` and stride parameters determine which elements in the strided arrays are accessed at runtime. For example, to compute the cumulative sum of every other element: ```javascript var Float64Array = require( '@stdlib/array-float64' ); @@ -148,7 +148,7 @@ The function has the following additional parameters: - **offsetX**: starting index for `x`. - **offsetY**: starting index for `y`. -While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, offset parameters support indexing semantics based on starting indices. For example, to calculate the cumulative sum of every other value in the strided input array starting from the second value and to store in the last `N` elements of the strided output array starting from the last element +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example, to calculate the cumulative sum of every other value in the strided input array starting from the second value and to store in the last `N` elements of the strided output array starting from the last element: ```javascript var Float64Array = require( '@stdlib/array-float64' ); @@ -244,9 +244,9 @@ The function accepts the following arguments: - **N**: `[in] CBLAS_INT` number of indexed elements. - **sum**: `[in] double` initial sum. - **X**: `[in] double*` input array. -- **strideX**: `[in] CBLAS_INT` index increment for `X`. +- **strideX**: `[in] CBLAS_INT` stride length for `X`. - **Y**: `[out] double*` output array. -- **strideY**: `[in] CBLAS_INT` index increment for `Y`. +- **strideY**: `[in] CBLAS_INT` stride length for `Y`. ```c void stdlib_strided_dcusumpw( const CBLAS_INT N, const double sum, const double *X, const CBLAS_INT strideX, double *Y, const CBLAS_INT strideY ); @@ -272,10 +272,10 @@ The function accepts the following arguments: - **N**: `[in] CBLAS_INT` number of indexed elements. - **sum**: `[in] double` initial sum. - **X**: `[in] double*` input array. -- **strideX**: `[in] CBLAS_INT` index increment for `X`. +- **strideX**: `[in] CBLAS_INT` stride length for `X`. - **offsetX**: `[in] CBLAS_INT` starting index for `X`. - **Y**: `[out] double*` output array. -- **strideY**: `[in] CBLAS_INT` index increment for `Y`. +- **strideY**: `[in] CBLAS_INT` stride length for `Y`. - **offsetY**: `[in] CBLAS_INT` starting index for `Y`. ```c @@ -386,7 +386,7 @@ See [LICENSE][stdlib-license]. ## Copyright -Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. +Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors].
diff --git a/dist/index.js.map b/dist/index.js.map index b1e1bda..a2bce62 100644 --- a/dist/index.js.map +++ b/dist/index.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../lib/ndarray.js", "../lib/dcusumpw.js", "../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 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 floor = require( '@stdlib/math-base-special-floor' );\n\n\n// VARIABLES //\n\n// Blocksize for pairwise summation:\nvar BLOCKSIZE = 128;\n\n\n// MAIN //\n\n/**\n* Computes the cumulative sum of double-precision floating-point strided array elements using pairwise summation.\n*\n* ## Method\n*\n* - This implementation uses pairwise summation, which accrues rounding error `O(log2 N)` instead of `O(N)`. The recursion depth is also `O(log2 N)`.\n*\n* ## References\n*\n* - Higham, Nicholas J. 1993. \"The Accuracy of Floating Point Summation.\" _SIAM Journal on Scientific Computing_ 14 (4): 783\u201399. doi:[10.1137/0914050](https://doi.org/10.1137/0914050).\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {number} sum - initial sum\n* @param {Float64Array} x - input array\n* @param {integer} strideX - `x` stride length\n* @param {NonNegativeInteger} offsetX - starting index for `x`\n* @param {Float64Array} y - output array\n* @param {integer} strideY - `y` stride length\n* @param {NonNegativeInteger} offsetY - starting index for `y`\n* @returns {Float64Array} output array\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var x = new Float64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );\n* var y = new Float64Array( x.length );\n*\n* var v = dcusumpw( 4, 0.0, x, 2, 1, y, 1, 0 );\n* // returns [ 1.0, -1.0, 1.0, 5.0, 0.0, 0.0, 0.0, 0.0 ]\n*/\nfunction dcusumpw( N, sum, x, strideX, offsetX, y, strideY, offsetY ) {\n\tvar ix;\n\tvar iy;\n\tvar s;\n\tvar n;\n\tvar i;\n\n\tif ( N <= 0 ) {\n\t\treturn y;\n\t}\n\tix = offsetX;\n\tiy = offsetY;\n\tif ( N <= BLOCKSIZE ) {\n\t\ts = 0.0;\n\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\ts += x[ ix ];\n\t\t\ty[ iy ] = sum + s;\n\t\t\tix += strideX;\n\t\t\tiy += strideY;\n\t\t}\n\t\treturn y;\n\t}\n\tn = floor( N/2 );\n\tdcusumpw( n, sum, x, strideX, ix, y, strideY, iy );\n\tiy += (n-1) * strideY;\n\tdcusumpw( N-n, y[ iy ], x, strideX, ix+(n*strideX), y, strideY, iy+strideY ); // eslint-disable-line max-len\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = dcusumpw;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 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 stride2offset = require( '@stdlib/strided-base-stride2offset' );\nvar ndarray = require( './ndarray.js' );\n\n\n// MAIN //\n\n/**\n* Computes the cumulative sum of double-precision floating-point strided array elements using pairwise summation.\n*\n* ## Method\n*\n* - This implementation uses pairwise summation, which accrues rounding error `O(log2 N)` instead of `O(N)`. The recursion depth is also `O(log2 N)`.\n*\n* ## References\n*\n* - Higham, Nicholas J. 1993. \"The Accuracy of Floating Point Summation.\" _SIAM Journal on Scientific Computing_ 14 (4): 783\u201399. doi:[10.1137/0914050](https://doi.org/10.1137/0914050).\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {number} sum - initial sum\n* @param {Float64Array} x - input array\n* @param {integer} strideX - `x` stride length\n* @param {Float64Array} y - output array\n* @param {integer} strideY - `y` stride length\n* @returns {Float64Array} output array\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var x = new Float64Array( [ 1.0, -2.0, 2.0 ] );\n* var y = new Float64Array( x.length );\n*\n* var v = dcusumpw( 3, 0.0, x, 1, y, 1 );\n* // returns [ 1.0, -1.0, 1.0 ]\n*/\nfunction dcusumpw( N, sum, x, strideX, y, strideY ) {\n\tndarray( N, sum, x, strideX, stride2offset( N, strideX ), y, strideY, stride2offset( N, strideY ) ); // eslint-disable-line max-len\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = dcusumpw;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 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 setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar dcusumpw = require( './dcusumpw.js' );\nvar ndarray = require( './ndarray.js' );\n\n\n// MAIN //\n\nsetReadOnly( dcusumpw, 'ndarray', ndarray );\n\n\n// EXPORTS //\n\nmodule.exports = dcusumpw;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 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* Compute the cumulative sum of double-precision floating-point strided array elements using pairwise summation.\n*\n* @module @stdlib/blas-ext-base-dcusumpw\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n* var dcusumpw = require( '@stdlib/blas-ext-base-dcusumpw' );\n*\n* var x = new Float64Array( [ 1.0, -2.0, 2.0 ] );\n* var y = new Float64Array( x.length );\n*\n* dcusumpw( 3, 0.0, x, 1, y, 1 );\n* // y => [ 1.0, -1.0, 1.0 ]\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n* var dcusumpw = require( '@stdlib/blas-ext-base-dcusumpw' );\n*\n* var x = new Float64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );\n* var y = new Float64Array( x.length );\n*\n* dcusumpw.ndarray( 4, 0.0, x, 2, 1, y, 1, 0 );\n* // y => [ 1.0, -1.0, 1.0, 5.0, 0.0, 0.0, 0.0, 0.0 ]\n*/\n\n// MODULES //\n\nvar join = require( 'path' ).join;\nvar tryRequire = require( '@stdlib/utils-try-require' );\nvar isError = require( '@stdlib/assert-is-error' );\nvar main = require( './main.js' );\n\n\n// MAIN //\n\nvar dcusumpw;\nvar tmp = tryRequire( join( __dirname, './native.js' ) );\nif ( isError( tmp ) ) {\n\tdcusumpw = main;\n} else {\n\tdcusumpw = tmp;\n}\n\n\n// EXPORTS //\n\nmodule.exports = dcusumpw;\n\n// exports: { \"ndarray\": \"dcusumpw.ndarray\" }\n"], + "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 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 floor = require( '@stdlib/math-base-special-floor' );\n\n\n// VARIABLES //\n\n// Blocksize for pairwise summation:\nvar BLOCKSIZE = 128;\n\n\n// MAIN //\n\n/**\n* Computes the cumulative sum of double-precision floating-point strided array elements using pairwise summation.\n*\n* ## Method\n*\n* - This implementation uses pairwise summation, which accrues rounding error `O(log2 N)` instead of `O(N)`. The recursion depth is also `O(log2 N)`.\n*\n* ## References\n*\n* - Higham, Nicholas J. 1993. \"The Accuracy of Floating Point Summation.\" _SIAM Journal on Scientific Computing_ 14 (4): 783\u201399. doi:[10.1137/0914050](https://doi.org/10.1137/0914050).\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {number} sum - initial sum\n* @param {Float64Array} x - input array\n* @param {integer} strideX - stride length for `x`\n* @param {NonNegativeInteger} offsetX - starting index for `x`\n* @param {Float64Array} y - output array\n* @param {integer} strideY - stride length for `y`\n* @param {NonNegativeInteger} offsetY - starting index for `y`\n* @returns {Float64Array} output array\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var x = new Float64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );\n* var y = new Float64Array( x.length );\n*\n* var v = dcusumpw( 4, 0.0, x, 2, 1, y, 1, 0 );\n* // returns [ 1.0, -1.0, 1.0, 5.0, 0.0, 0.0, 0.0, 0.0 ]\n*/\nfunction dcusumpw( N, sum, x, strideX, offsetX, y, strideY, offsetY ) {\n\tvar ix;\n\tvar iy;\n\tvar s;\n\tvar n;\n\tvar i;\n\n\tif ( N <= 0 ) {\n\t\treturn y;\n\t}\n\tix = offsetX;\n\tiy = offsetY;\n\tif ( N <= BLOCKSIZE ) {\n\t\ts = 0.0;\n\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\ts += x[ ix ];\n\t\t\ty[ iy ] = sum + s;\n\t\t\tix += strideX;\n\t\t\tiy += strideY;\n\t\t}\n\t\treturn y;\n\t}\n\tn = floor( N/2 );\n\tdcusumpw( n, sum, x, strideX, ix, y, strideY, iy );\n\tiy += (n-1) * strideY;\n\tdcusumpw( N-n, y[ iy ], x, strideX, ix+(n*strideX), y, strideY, iy+strideY ); // eslint-disable-line max-len\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = dcusumpw;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 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 stride2offset = require( '@stdlib/strided-base-stride2offset' );\nvar ndarray = require( './ndarray.js' );\n\n\n// MAIN //\n\n/**\n* Computes the cumulative sum of double-precision floating-point strided array elements using pairwise summation.\n*\n* ## Method\n*\n* - This implementation uses pairwise summation, which accrues rounding error `O(log2 N)` instead of `O(N)`. The recursion depth is also `O(log2 N)`.\n*\n* ## References\n*\n* - Higham, Nicholas J. 1993. \"The Accuracy of Floating Point Summation.\" _SIAM Journal on Scientific Computing_ 14 (4): 783\u201399. doi:[10.1137/0914050](https://doi.org/10.1137/0914050).\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {number} sum - initial sum\n* @param {Float64Array} x - input array\n* @param {integer} strideX - stride length for `x`\n* @param {Float64Array} y - output array\n* @param {integer} strideY - stride length for `y`\n* @returns {Float64Array} output array\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var x = new Float64Array( [ 1.0, -2.0, 2.0 ] );\n* var y = new Float64Array( x.length );\n*\n* var v = dcusumpw( 3, 0.0, x, 1, y, 1 );\n* // returns [ 1.0, -1.0, 1.0 ]\n*/\nfunction dcusumpw( N, sum, x, strideX, y, strideY ) {\n\tndarray( N, sum, x, strideX, stride2offset( N, strideX ), y, strideY, stride2offset( N, strideY ) ); // eslint-disable-line max-len\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = dcusumpw;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 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 setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar dcusumpw = require( './dcusumpw.js' );\nvar ndarray = require( './ndarray.js' );\n\n\n// MAIN //\n\nsetReadOnly( dcusumpw, 'ndarray', ndarray );\n\n\n// EXPORTS //\n\nmodule.exports = dcusumpw;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 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* Compute the cumulative sum of double-precision floating-point strided array elements using pairwise summation.\n*\n* @module @stdlib/blas-ext-base-dcusumpw\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n* var dcusumpw = require( '@stdlib/blas-ext-base-dcusumpw' );\n*\n* var x = new Float64Array( [ 1.0, -2.0, 2.0 ] );\n* var y = new Float64Array( x.length );\n*\n* dcusumpw( 3, 0.0, x, 1, y, 1 );\n* // y => [ 1.0, -1.0, 1.0 ]\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n* var dcusumpw = require( '@stdlib/blas-ext-base-dcusumpw' );\n*\n* var x = new Float64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );\n* var y = new Float64Array( x.length );\n*\n* dcusumpw.ndarray( 4, 0.0, x, 2, 1, y, 1, 0 );\n* // y => [ 1.0, -1.0, 1.0, 5.0, 0.0, 0.0, 0.0, 0.0 ]\n*/\n\n// MODULES //\n\nvar join = require( 'path' ).join;\nvar tryRequire = require( '@stdlib/utils-try-require' );\nvar isError = require( '@stdlib/assert-is-error' );\nvar main = require( './main.js' );\n\n\n// MAIN //\n\nvar dcusumpw;\nvar tmp = tryRequire( join( __dirname, './native.js' ) );\nif ( isError( tmp ) ) {\n\tdcusumpw = main;\n} else {\n\tdcusumpw = tmp;\n}\n\n\n// EXPORTS //\n\nmodule.exports = dcusumpw;\n\n// exports: { \"ndarray\": \"dcusumpw.ndarray\" }\n"], "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAQ,QAAS,iCAAkC,EAMnDC,EAAY,IAmChB,SAASC,EAAUC,EAAGC,EAAKC,EAAGC,EAASC,EAASC,EAAGC,EAASC,EAAU,CACrE,IAAIC,EACAC,EACAC,EACAC,EACAC,EAEJ,GAAKZ,GAAK,EACT,OAAOK,EAIR,GAFAG,EAAKJ,EACLK,EAAKF,EACAP,GAAKF,EAAY,CAErB,IADAY,EAAI,EACEE,EAAI,EAAGA,EAAIZ,EAAGY,IACnBF,GAAKR,EAAGM,CAAG,EACXH,EAAGI,CAAG,EAAIR,EAAMS,EAChBF,GAAML,EACNM,GAAMH,EAEP,OAAOD,CACR,CACA,OAAAM,EAAId,EAAOG,EAAE,CAAE,EACfD,EAAUY,EAAGV,EAAKC,EAAGC,EAASK,EAAIH,EAAGC,EAASG,CAAG,EACjDA,IAAOE,EAAE,GAAKL,EACdP,EAAUC,EAAEW,EAAGN,EAAGI,CAAG,EAAGP,EAAGC,EAASK,EAAIG,EAAER,EAAUE,EAAGC,EAASG,EAAGH,CAAQ,EACpED,CACR,CAKAT,EAAO,QAAUG,IC/FjB,IAAAc,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAgB,QAAS,oCAAqC,EAC9DC,EAAU,IAiCd,SAASC,EAAUC,EAAGC,EAAKC,EAAGC,EAASC,EAAGC,EAAU,CACnD,OAAAP,EAASE,EAAGC,EAAKC,EAAGC,EAASN,EAAeG,EAAGG,CAAQ,EAAGC,EAAGC,EAASR,EAAeG,EAAGK,CAAQ,CAAE,EAC3FD,CACR,CAKAR,EAAO,QAAUG,IChEjB,IAAAO,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAc,QAAS,uDAAwD,EAC/EC,EAAW,IACXC,EAAU,IAKdF,EAAaC,EAAU,UAAWC,CAAQ,EAK1CH,EAAO,QAAUE,ICcjB,IAAIE,EAAO,QAAS,MAAO,EAAE,KACzBC,EAAa,QAAS,2BAA4B,EAClDC,EAAU,QAAS,yBAA0B,EAC7CC,EAAO,IAKPC,EACAC,EAAMJ,EAAYD,EAAM,UAAW,aAAc,CAAE,EAClDE,EAASG,CAAI,EACjBD,EAAWD,EAEXC,EAAWC,EAMZ,OAAO,QAAUD", "names": ["require_ndarray", "__commonJSMin", "exports", "module", "floor", "BLOCKSIZE", "dcusumpw", "N", "sum", "x", "strideX", "offsetX", "y", "strideY", "offsetY", "ix", "iy", "s", "n", "i", "require_dcusumpw", "__commonJSMin", "exports", "module", "stride2offset", "ndarray", "dcusumpw", "N", "sum", "x", "strideX", "y", "strideY", "require_main", "__commonJSMin", "exports", "module", "setReadOnly", "dcusumpw", "ndarray", "join", "tryRequire", "isError", "main", "dcusumpw", "tmp"] } diff --git a/docs/repl.txt b/docs/repl.txt index fef8395..36473fb 100644 --- a/docs/repl.txt +++ b/docs/repl.txt @@ -3,8 +3,8 @@ Computes the cumulative sum of double-precision floating-point strided array elements using pairwise summation. - The `N` and stride parameters determine which elements in the strided - arrays are accessed at runtime. + The `N` and stride parameters determine which elements in the strided arrays + are accessed at runtime. Indexing is relative to the first index. To introduce an offset, use a typed array view. @@ -23,13 +23,13 @@ Input array. strideX: integer - Index increment for `x`. + Stride length for `x`. y: Float64Array Output array. strideY: integer - Index increment for `y`. + Stride length for `y`. Returns ------- @@ -44,7 +44,7 @@ > {{alias}}( x.length, 0.0, x, 1, y, 1 ) [ 1.0, -1.0, 1.0 ] - // Using `N` and `stride` parameters: + // Using `N` and stride parameters: > x = new {{alias:@stdlib/array/float64}}( [ -2.0, 1.0, 1.0, -5.0, 2.0, -1.0 ] ); > y = new {{alias:@stdlib/array/float64}}( x.length ); > {{alias}}( 3, 0.0, x, 2, y, 2 ) @@ -66,7 +66,7 @@ elements using pairwise summation and alternative indexing semantics. While typed array views mandate a view offset based on the underlying - buffer, offset parameters support indexing semantics based on starting + buffer, the offset parameters support indexing semantics based on starting indices. Parameters @@ -81,7 +81,7 @@ Input array. strideX: integer - Index increment for `x`. + Stride length for `x`. offsetX: integer Starting index for `x`. @@ -90,7 +90,7 @@ Output array. strideY: integer - Index increment for `y`. + Stride length for `y`. offsetY: integer Starting index for `y`. diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts index 5518eb2..fffb115 100644 --- a/docs/types/index.d.ts +++ b/docs/types/index.d.ts @@ -28,9 +28,9 @@ interface Routine { * @param N - number of indexed elements * @param sum - initial sum * @param x - input array - * @param strideX - `x` stride length + * @param strideX - stride length for `x` * @param y - output array - * @param strideY - `y` stride length + * @param strideY - stride length for `y` * @returns output array * * @example @@ -50,10 +50,10 @@ interface Routine { * @param N - number of indexed elements * @param sum - initial sum * @param x - input array - * @param strideX - `x` stride length + * @param strideX - stride length for `x` * @param offsetX - starting index for `x` * @param y - output array - * @param strideY - `y` stride length + * @param strideY - stride length for `y` * @param offsetY - starting index for `y` * @returns output array * @@ -75,9 +75,9 @@ interface Routine { * @param N - number of indexed elements * @param sum - initial sum * @param x - input array -* @param strideX - `x` stride length +* @param strideX - stride length for `x` * @param y - output array -* @param strideY - `y` stride length +* @param strideY - stride length for `y` * @returns output array * * @example diff --git a/lib/dcusumpw.js b/lib/dcusumpw.js index 7b0f07e..aa7ed44 100644 --- a/lib/dcusumpw.js +++ b/lib/dcusumpw.js @@ -40,9 +40,9 @@ var ndarray = require( './ndarray.js' ); * @param {PositiveInteger} N - number of indexed elements * @param {number} sum - initial sum * @param {Float64Array} x - input array -* @param {integer} strideX - `x` stride length +* @param {integer} strideX - stride length for `x` * @param {Float64Array} y - output array -* @param {integer} strideY - `y` stride length +* @param {integer} strideY - stride length for `y` * @returns {Float64Array} output array * * @example diff --git a/lib/dcusumpw.native.js b/lib/dcusumpw.native.js index b41c345..fd5d36b 100644 --- a/lib/dcusumpw.native.js +++ b/lib/dcusumpw.native.js @@ -31,9 +31,9 @@ var addon = require( './../src/addon.node' ); * @param {PositiveInteger} N - number of indexed elements * @param {number} sum - initial sum * @param {Float64Array} x - input array -* @param {integer} strideX - `x` stride length +* @param {integer} strideX - stride length for `x` * @param {Float64Array} y - output array -* @param {integer} strideY - `y` stride length +* @param {integer} strideY - stride length for `y` * @returns {Float64Array} output array * * @example diff --git a/lib/ndarray.js b/lib/ndarray.js index a93236b..af2fe27 100644 --- a/lib/ndarray.js +++ b/lib/ndarray.js @@ -45,10 +45,10 @@ var BLOCKSIZE = 128; * @param {PositiveInteger} N - number of indexed elements * @param {number} sum - initial sum * @param {Float64Array} x - input array -* @param {integer} strideX - `x` stride length +* @param {integer} strideX - stride length for `x` * @param {NonNegativeInteger} offsetX - starting index for `x` * @param {Float64Array} y - output array -* @param {integer} strideY - `y` stride length +* @param {integer} strideY - stride length for `y` * @param {NonNegativeInteger} offsetY - starting index for `y` * @returns {Float64Array} output array * diff --git a/lib/ndarray.native.js b/lib/ndarray.native.js index 3bb661c..9fc66ec 100644 --- a/lib/ndarray.native.js +++ b/lib/ndarray.native.js @@ -31,10 +31,10 @@ var addon = require( './../src/addon.node' ); * @param {PositiveInteger} N - number of indexed elements * @param {number} sum - initial sum * @param {Float64Array} x - input array -* @param {integer} strideX - `x` stride length +* @param {integer} strideX - stride length for `x` * @param {NonNegativeInteger} offsetX - starting index for `x` * @param {Float64Array} y - output array -* @param {integer} strideY - `y` stride length +* @param {integer} strideY - stride length for `y` * @param {NonNegativeInteger} offsetY - starting index for `y` * @returns {Float64Array} output array * diff --git a/src/main.c b/src/main.c index fc64d0d..1b478bf 100644 --- a/src/main.c +++ b/src/main.c @@ -26,9 +26,9 @@ * @param N number of indexed elements * @param sum initial sum * @param X input array -* @param strideX X stride length +* @param strideX stride length for X * @param Y output array -* @param strideY Y stride length +* @param strideY stride length for Y */ void API_SUFFIX(stdlib_strided_dcusumpw)( const CBLAS_INT N, const double sum, const double *X, const CBLAS_INT strideX, double *Y, const CBLAS_INT strideY ) { const CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX ); @@ -50,11 +50,11 @@ void API_SUFFIX(stdlib_strided_dcusumpw)( const CBLAS_INT N, const double sum, c * @param N number of indexed elements * @param sum initial sum * @param X input array -* @param strideX X index increment -* @param offsetX X starting index +* @param strideX stride length for X +* @param offsetX starting index for X * @param Y output array -* @param strideY Y index increment -* @param offsetY Y starting index +* @param strideY stride length for Y +* @param offsetY starting index for Y */ void API_SUFFIX(stdlib_strided_dcusumpw_ndarray)( const CBLAS_INT N, const double sum, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, double *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY ) { CBLAS_INT ix;