diff --git a/.github/.keepalive b/.github/.keepalive index c1c3e7e..c3f2d84 100644 --- a/.github/.keepalive +++ b/.github/.keepalive @@ -1 +1 @@ -2024-09-01T01:02:40.696Z +2024-10-01T01:07:47.938Z diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 57d1184..d74d10f 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2,6 +2,7 @@ # # Contributors listed in alphabetical order. +Aayush Khanna Adarsh Palaskar Aditya Sapra AgPriyanshu18 <113460573+AgPriyanshu18@users.noreply.github.com> @@ -20,23 +21,27 @@ Christopher Dambamuromo Dan Rose Daniel Killenberger Daniel Yu <40680511+Daniel777y@users.noreply.github.com> +Debashis Maharana Dominik Moritz Dorrin Sotoudeh EuniceSim142 <77243938+EuniceSim142@users.noreply.github.com> Frank Kovacs Golden Kumar <103646877+AuenKr@users.noreply.github.com> Gunj Joshi +HarshaNP <96897754+GittyHarsha@users.noreply.github.com> Harshita Kalani Hridyanshu <124202756+HRIDYANSHU054@users.noreply.github.com> Jaimin Godhani <112328542+Jai0401@users.noreply.github.com> James Gelok Jaysukh Makvana +Jenish Thapa <141203631+jenish-thapa@users.noreply.github.com> Jithin KS Joel Mathew Koshy Joey Reed Jordan Gallivan <115050475+Jordan-Gallivan@users.noreply.github.com> Joris Labie Justin Dennison +Kaif Mohd Karthik Prakash <116057817+skoriop@users.noreply.github.com> Khaldon Krishnendu Das <86651039+itskdhere@users.noreply.github.com> @@ -86,13 +91,17 @@ Stephannie JimĂ©nez Gacha Suraj kumar <125961509+kumarsuraj212003@users.noreply.github.com> Tirtadwipa Manunggal Tudor Pagu <104032457+tudor-pagu@users.noreply.github.com> +Tufailahmed Bargir <142114244+Tufailahmed-Bargir@users.noreply.github.com> Utkarsh Utkarsh Raj +Vaibhav Patel <98279986+noobCoderVP@users.noreply.github.com> Varad Gupta Xiaochuan Ye Yernar Yergaziyev naveen nishant-s7 <97207366+nishant-s7@users.noreply.github.com> +olenkabilonizhka <62379231+olenkabilonizhka@users.noreply.github.com> orimiles5 <97595296+orimiles5@users.noreply.github.com> rainn <88160429+AmCodesLame@users.noreply.github.com> rei2hu +yaswanth <116426380+yaswanthkosuru@users.noreply.github.com> diff --git a/README.md b/README.md index 8ea385e..aa0f215 100644 --- a/README.md +++ b/README.md @@ -253,11 +253,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]. @@ -304,8 +299,6 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. [esm-readme]: https://github.com/stdlib-js/blas-ext-base-gcusumors/blob/esm/README.md [branches-url]: https://github.com/stdlib-js/blas-ext-base-gcusumors/blob/main/branches.md -[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/blas-ext-base-gcusumors/main/LICENSE - [mdn-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array [mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray diff --git a/dist/index.js b/dist/index.js index 63b276f..b8726eb 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,7 +1,45 @@ -"use strict";var c=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var l=c(function(h,x){ -function m(e,r,o,t,s,a){var u,n,i;if(e<=0)return s;for(t<0?u=(1-e)*t:u=0,a<0?n=(1-e)*a:n=0,i=0;i [ 1.0, -1.0, 1.0 ] +* +* @example +* var floor = require( '@stdlib/math-base-special-floor' ); +* var gcusumors = require( '@stdlib/blas-ext-base-gcusumors' ); +* +* var x = [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ]; +* var y = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]; +* var N = floor( x.length / 2 ); +* +* gcusumors.ndarray( N, 0.0, x, 2, 1, y, 1, 0 ); +* // y => [ 1.0, -1.0, 1.0, 5.0, 0.0, 0.0, 0.0, 0.0 ] +*/ + +// MODULES // + +var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property/dist' ); +var main = require( './main.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( main, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = main; diff --git a/dist/main.js b/dist/main.js new file mode 100644 index 0000000..d2bb4f9 --- /dev/null +++ b/dist/main.js @@ -0,0 +1,71 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2020 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'; + +// MAIN // + +/** +* Computes the cumulative sum of strided array elements using ordinary recursive summation. +* +* @param {PositiveInteger} N - number of indexed elements +* @param {number} sum - initial sum +* @param {NumericArray} x - input array +* @param {integer} strideX - `x` stride length +* @param {NumericArray} y - output array +* @param {integer} strideY - `y` stride length +* @returns {NumericArray} output array +* +* @example +* var x = [ 1.0, -2.0, 2.0 ]; +* var y = [ 0.0, 0.0, 0.0 ]; +* +* var v = gcusumors( x.length, 0.0, x, 1, y, 1 ); +* // returns [ 1.0, -1.0, 1.0 ] +*/ +function gcusumors( N, sum, x, strideX, y, strideY ) { + var ix; + var iy; + var i; + + if ( N <= 0 ) { + return y; + } + if ( strideX < 0 ) { + ix = (1-N) * strideX; + } else { + ix = 0; + } + if ( strideY < 0 ) { + iy = (1-N) * strideY; + } else { + iy = 0; + } + for ( i = 0; i < N; i++ ) { + sum += x[ ix ]; + y[ iy ] = sum; + ix += strideX; + iy += strideY; + } + return y; +} + + +// EXPORTS // + +module.exports = gcusumors; diff --git a/dist/ndarray.js b/dist/ndarray.js new file mode 100644 index 0000000..56ed422 --- /dev/null +++ b/dist/ndarray.js @@ -0,0 +1,68 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2020 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'; + +// MAIN // + +/** +* Computes the cumulative sum of strided array elements using ordinary recursive summation. +* +* @param {PositiveInteger} N - number of indexed elements +* @param {number} sum - initial sum +* @param {NumericArray} x - input array +* @param {integer} strideX - `x` stride length +* @param {NonNegativeInteger} offsetX - starting index for `x` +* @param {NumericArray} y - output array +* @param {integer} strideY - `y` stride length +* @param {NonNegativeInteger} offsetY - starting index for `y` +* @returns {NumericArray} output array +* +* @example +* var floor = require( '@stdlib/math-base-special-floor' ); +* +* var x = [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ]; +* var y = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]; +* var N = floor( x.length / 2 ); +* +* gcusumors( N, 0.0, x, 2, 1, y, 1, 0 ); +* // y => [ 1.0, -1.0, 1.0, 5.0, 0.0, 0.0, 0.0, 0.0 ] +*/ +function gcusumors( N, sum, x, strideX, offsetX, y, strideY, offsetY ) { + var ix; + var iy; + var i; + + if ( N <= 0 ) { + return y; + } + ix = offsetX; + iy = offsetY; + for ( i = 0; i < N; i++ ) { + sum += x[ ix ]; + y[ iy ] = sum; + ix += strideX; + iy += strideY; + } + return y; +} + + +// EXPORTS // + +module.exports = gcusumors;