From 3f48be5fefc21d4a9e86e096ecfa618bb75db23e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 6 Jul 2024 06:12:30 +0000 Subject: [PATCH] Auto-generated commit --- .github/workflows/publish.yml | 4 + CHANGELOG.md | 136 +++++++++++++++++++++++++++++++++- CONTRIBUTORS | 6 +- README.md | 2 +- dist/index.js | 14 ++-- dist/index.js.map | 8 +- lib/dsdot.js | 49 ++---------- package.json | 5 +- 8 files changed, 166 insertions(+), 58 deletions(-) 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 2b81d54..8e745f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,4 +2,138 @@ > Package changelog. -See [GitHub Releases](https://github.com/stdlib-js/blas-base-dsdot/releases) for the changelog. \ No newline at end of file +
+ +## Unreleased (2024-07-06) + +
+ +### Features + +- [`4508f54`](https://github.com/stdlib-js/stdlib/commit/4508f546e500ff3c38ac50b0d2613daa40b7266e) - add support for specifying integer size + +
+ + + +
+ +### Bug Fixes + +- [`5c514c7`](https://github.com/stdlib-js/stdlib/commit/5c514c7ad5828bc5047594ff001d11334f8f5670) - specify integer type to match CBLAS + +
+ + + +
+ +### Commits + +
+ +- [`271f5d5`](https://github.com/stdlib-js/stdlib/commit/271f5d5d3e530225bd82f34efebf5df9a944fdde) - **refactor:** reduce code duplication in `blas/base` level 1 routines [(#2517)](https://github.com/stdlib-js/stdlib/pull/2517) _(by Aman Bhansali)_ +- [`6226f32`](https://github.com/stdlib-js/stdlib/commit/6226f32ba8be2b8d880353194c510e629760b53f) - **docs:** update signatures _(by Athan Reines)_ +- [`10d5253`](https://github.com/stdlib-js/stdlib/commit/10d525313201bf6f4c62c6eee2b46065ad180de2) - **refactor:** support building with API suffix _(by Athan Reines)_ +- [`5c514c7`](https://github.com/stdlib-js/stdlib/commit/5c514c7ad5828bc5047594ff001d11334f8f5670) - **fix:** specify integer type to match CBLAS _(by Athan Reines)_ +- [`41a012f`](https://github.com/stdlib-js/stdlib/commit/41a012f6167cab7b2442be74b40819346ea9b0f1) - **docs:** remove comments _(by Athan Reines)_ +- [`4508f54`](https://github.com/stdlib-js/stdlib/commit/4508f546e500ff3c38ac50b0d2613daa40b7266e) - **feat:** add support for specifying integer size _(by Athan Reines)_ +- [`38464b7`](https://github.com/stdlib-js/stdlib/commit/38464b74545be9702eda7bae820c40b56e7e7256) - **docs:** remove comments _(by Athan Reines)_ +- [`f1576ec`](https://github.com/stdlib-js/stdlib/commit/f1576ec5ade09cd8cd034dc0db8c9f5c7d70e3eb) - **docs:** remove comments _(by Athan Reines)_ +- [`d52893b`](https://github.com/stdlib-js/stdlib/commit/d52893bbb6c0f27f5d9560e6acdf53f7c68b1920) - **refactor:** use macro for creating doubles _(by Athan Reines)_ +- [`8aa07d0`](https://github.com/stdlib-js/stdlib/commit/8aa07d0853cf4ec3c58e20f7093c74b95d6b7430) - **build:** add separate configurations for benchmarks and examples _(by Athan Reines)_ +- [`0244027`](https://github.com/stdlib-js/stdlib/commit/0244027e1e2c0ceb1cd8ae1808196c24fa77b142) - **chore:** add missing trailing newlines _(by Philipp Burckhardt)_ +- [`28433d6`](https://github.com/stdlib-js/stdlib/commit/28433d637a39abec34dddc51d88c59fdc7c38f3a) - **docs:** clean-up C function parameter and return annotations _(by Philipp Burckhardt)_ + +
+ +
+ + + +
+ +### Contributors + +A total of 3 people contributed to this release. Thank you to the following contributors: + +- Aman Bhansali +- Athan Reines +- Philipp Burckhardt + +
+ + + +
+ + + +
+ +## 0.2.1 (2024-02-22) + +
+ +### Features + +- [`cca37d0`](https://github.com/stdlib-js/stdlib/commit/cca37d051d8c0209970fc681353fdb4e4d257a8a) - update minimum TypeScript version + +
+ + + +
+ +### BREAKING CHANGES + +- [`cca37d0`](https://github.com/stdlib-js/stdlib/commit/cca37d051d8c0209970fc681353fdb4e4d257a8a): update minimum TypeScript version +- [`cca37d0`](https://github.com/stdlib-js/stdlib/commit/cca37d051d8c0209970fc681353fdb4e4d257a8a): update minimum TypeScript version to 4.1 + + - To migrate, users should upgrade their TypeScript version to at least version 4.1. + +
+ + + +
+ +### Commits + +
+ +- [`dea49e0`](https://github.com/stdlib-js/stdlib/commit/dea49e03ab5571233e3da26835a6a6d3256d5737) - **docs:** use single quotes in require calls instead of backticks _(by Philipp Burckhardt)_ +- [`004b244`](https://github.com/stdlib-js/stdlib/commit/004b24478b4af2a51f2e568fe2c1efd8cb5ef59d) - **docs:** update examples to use random/array utilities _(by Athan Reines)_ +- [`efc6522`](https://github.com/stdlib-js/stdlib/commit/efc65220a39e226839fd507b59190d6402bebe61) - **bench:** update benchmarks to use random/array utilities _(by Athan Reines)_ +- [`c8aca89`](https://github.com/stdlib-js/stdlib/commit/c8aca89f546082a43ddb679d236d60b5d3f3a39d) - **refactor:** update implementation according to current project conventions _(by Athan Reines)_ +- [`5a36be3`](https://github.com/stdlib-js/stdlib/commit/5a36be3f681bf65914abdc58bbc3142533cb2328) - **style:** resolve lint errors _(by Athan Reines)_ +- [`df3c9b3`](https://github.com/stdlib-js/stdlib/commit/df3c9b368d8a3dd7dd38f8768deb53c2a780c055) - **build:** remove tslint directives _(by Philipp Burckhardt)_ +- [`cca37d0`](https://github.com/stdlib-js/stdlib/commit/cca37d051d8c0209970fc681353fdb4e4d257a8a) - **feat:** update minimum TypeScript version _(by Philipp Burckhardt)_ +- [`42c921a`](https://github.com/stdlib-js/stdlib/commit/42c921ab62b8cdf789a9e76b06b18074e850af5e) - **docs:** resolve C lint errors _(by Athan Reines)_ +- [`28e1c84`](https://github.com/stdlib-js/stdlib/commit/28e1c84390d88044883c9ef940a12f38d66ea3ef) - **docs:** resolve C lint errors _(by Athan Reines)_ +- [`a9f7c78`](https://github.com/stdlib-js/stdlib/commit/a9f7c78cf0414fd5b48418008de73910e71ec02e) - **docs:** render equations via math code blocks _(by Philipp Burckhardt)_ +- [`9d552f8`](https://github.com/stdlib-js/stdlib/commit/9d552f8ee1087df295267fd3ddc2e5a04526ed6a) - **docs:** standardize parameter description and update docs _(by Athan Reines)_ + +
+ +
+ + + +
+ +### Contributors + +A total of 2 people contributed to this release. Thank you to the following contributors: + +- Athan Reines +- Philipp Burckhardt + +
+ + + +
+ + + diff --git a/CONTRIBUTORS b/CONTRIBUTORS index fcfcfa2..7ec15a7 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -27,6 +27,7 @@ Frank Kovacs Golden Kumar <103646877+AuenKr@users.noreply.github.com> Gunj Joshi Harshita Kalani +Hridyanshu <124202756+HRIDYANSHU054@users.noreply.github.com> Jaimin Godhani <112328542+Jai0401@users.noreply.github.com> James Gelok Jaysukh Makvana @@ -62,6 +63,7 @@ Pushpendra Chandravanshi Raunak Kumar Gupta Rejoan Sardar <119718513+Rejoan-Sardar@users.noreply.github.com> Ricky Reusser +Ridam Garg <67867319+RidamGarg@users.noreply.github.com> Robert Gislason Roman Stetsyk <25715951+romanstetsyk@users.noreply.github.com> Rutam <138517416+performant23@users.noreply.github.com> @@ -73,7 +75,8 @@ Shivam <11shivam00@gmail.com> Shraddheya Shendre Shubh Mehta <93862397+Shubh942@users.noreply.github.com> Shubham Mishra -Snehil Shah <130062020+Snehil-Shah@users.noreply.github.com> +Sivam Das <100067002+Sivam2313@users.noreply.github.com> +Snehil Shah Soumajit Chatterjee <121816890+soumajit23@users.noreply.github.com> Spandan Barve Stephannie Jiménez Gacha @@ -83,6 +86,7 @@ Tudor Pagu <104032457+tudor-pagu@users.noreply.github.com> Utkarsh Utkarsh Raj Varad Gupta +Xiaochuan Ye Yernar Yergaziyev naveen nishant-s7 <97207366+nishant-s7@users.noreply.github.com> diff --git a/README.md b/README.md index 9d9ac96..17ccf43 100644 --- a/README.md +++ b/README.md @@ -236,7 +236,7 @@ console.log( out ); #include "stdlib/blas/base/dsdot.h" ``` -#### c_dsdot( N, X, strideX, Y, strideY ) +#### c_dsdot( N, \*X, strideX, \*Y, strideY ) Computes the dot product of two single-precision floating-point vectors with extended accumulation and result. diff --git a/dist/index.js b/dist/index.js index e06f0e5..f01f6af 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,9 +1,9 @@ -"use strict";var d=function(i,e){return function(){return e||i((e={exports:{}}).exports,e),e.exports}};var j=d(function(F,l){ -var m=5;function g(i,e,f,o,u){var v,s,t,a,r;if(v=0,i<=0)return v;if(f===1&&u===1){if(a=i%m,a>0)for(r=0;r0)for(n=0;n0)for(u=0;u 0 ) {\n\t\t\tfor ( i = 0; i < m; i++ ) {\n\t\t\t\tdot += x[ i ] * y[ i ];\n\t\t\t}\n\t\t}\n\t\tif ( N < M ) {\n\t\t\treturn dot;\n\t\t}\n\t\tfor ( i = m; i < N; i += M ) {\n\t\t\tdot += ( x[i]*y[i] ) + ( x[i+1]*y[i+1] ) + ( x[i+2]*y[i+2] ) + ( x[i+3]*y[i+3] ) + ( x[i+4]*y[i+4] ); // eslint-disable-line max-len\n\t\t}\n\t\treturn dot;\n\t}\n\tif ( strideX < 0 ) {\n\t\tix = ( 1-N ) * strideX;\n\t} else {\n\t\tix = 0;\n\t}\n\tif ( strideY < 0 ) {\n\t\tiy = ( 1-N ) * strideY;\n\t} else {\n\t\tiy = 0;\n\t}\n\tfor ( i = 0; i < N; i++ ) {\n\t\tdot += x[ ix ] * y[ iy ];\n\t\tix += strideX;\n\t\tiy += strideY;\n\t}\n\treturn dot;\n}\n\n\n// EXPORTS //\n\nmodule.exports = dsdot;\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// VARIABLES //\n\nvar M = 5;\n\n\n// MAIN //\n\n/**\n* Computes the dot product of `x` and `y` with extended accumulation and result.\n*\n* @param {integer} N - number of indexed elements\n* @param {Float32Array} x - first input array\n* @param {integer} strideX - `x` stride length\n* @param {NonNegativeInteger} offsetX - starting index for `x`\n* @param {Float32Array} y - second input array\n* @param {integer} strideY - `y` stride length\n* @param {NonNegativeInteger} offsetY - starting index for `y`\n* @returns {number} dot product\n*\n* @example\n* var Float32Array = require( '@stdlib/array-float32' );\n*\n* var x = new Float32Array( [ 4.0, 2.0, -3.0, 5.0, -1.0 ] );\n* var y = new Float32Array( [ 2.0, 6.0, -1.0, -4.0, 8.0 ] );\n*\n* var z = dsdot( x.length, x, 1, 0, y, 1, 0 );\n* // returns -5.0\n*/\nfunction dsdot( N, x, strideX, offsetX, y, strideY, offsetY ) {\n\tvar dot;\n\tvar ix;\n\tvar iy;\n\tvar m;\n\tvar i;\n\n\tdot = 0.0;\n\tif ( N <= 0 ) {\n\t\treturn dot;\n\t}\n\tix = offsetX;\n\tiy = offsetY;\n\n\t// Use unrolled loops if both strides are equal to `1`...\n\tif ( strideX === 1 && strideY === 1 ) {\n\t\tm = N % M;\n\n\t\t// If we have a remainder, run a clean-up loop...\n\t\tif ( m > 0 ) {\n\t\t\tfor ( i = 0; i < m; i++ ) {\n\t\t\t\tdot += x[ ix ] * y[ iy ];\n\t\t\t\tix += 1;\n\t\t\t\tiy += 1;\n\t\t\t}\n\t\t}\n\t\tif ( N < M ) {\n\t\t\treturn dot;\n\t\t}\n\t\tfor ( i = m; i < N; i += M ) {\n\t\t\tdot += ( x[ix]*y[iy] ) + ( x[ix+1]*y[iy+1] ) + ( x[ix+2]*y[iy+2] ) + ( x[ix+3]*y[iy+3] ) + ( x[ix+4]*y[iy+4] ); // eslint-disable-line max-len\n\t\t\tix += M;\n\t\t\tiy += M;\n\t\t}\n\t\treturn dot;\n\t}\n\tfor ( i = 0; i < N; i++ ) {\n\t\tdot += x[ ix ] * y[ iy ];\n\t\tix += strideX;\n\t\tiy += strideY;\n\t}\n\treturn dot;\n}\n\n\n// EXPORTS //\n\nmodule.exports = dsdot;\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 dsdot = require( './dsdot.js' );\nvar ndarray = require( './ndarray.js' );\n\n\n// MAIN //\n\nsetReadOnly( dsdot, 'ndarray', ndarray );\n\n\n// EXPORTS //\n\nmodule.exports = dsdot;\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* BLAS level 1 routine to compute the dot product of vectors `x` and `y` with extended accumulation and result.\n*\n* @module @stdlib/blas-base-dsdot\n*\n* @example\n* var Float32Array = require( '@stdlib/array-float32' );\n* var dsdot = require( '@stdlib/blas-base-dsdot' );\n*\n* var x = new Float32Array( [ 4.0, 2.0, -3.0, 5.0, -1.0 ] );\n* var y = new Float32Array( [ 2.0, 6.0, -1.0, -4.0, 8.0 ] );\n*\n* var z = dsdot( x.length, x, 1, y, 1 );\n* // returns -12.0\n*\n* @example\n* var Float32Array = require( '@stdlib/array-float32' );\n* var dsdot = require( '@stdlib/blas-base-dsdot' );\n*\n* var x = new Float32Array( [ 4.0, 2.0, -3.0, 5.0, -1.0 ] );\n* var y = new Float32Array( [ 2.0, 6.0, -1.0, -4.0, 8.0 ] );\n*\n* var z = dsdot.ndarray( x.length, x, 1, 0, y, 1, 0 );\n* // returns -12.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 dsdot;\nvar tmp = tryRequire( join( __dirname, './native.js' ) );\nif ( isError( tmp ) ) {\n\tdsdot = main;\n} else {\n\tdsdot = tmp;\n}\n\n\n// EXPORTS //\n\nmodule.exports = dsdot;\n\n// exports: { \"ndarray\": \"dsdot.ndarray\" }\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAI,EAwBR,SAASC,EAAOC,EAAGC,EAAGC,EAASC,EAAGC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EAGJ,GADAJ,EAAM,EACDL,GAAK,EACT,OAAOK,EAGR,GAAKH,IAAY,GAAKE,IAAY,EAAI,CAIrC,GAHAI,EAAIR,EAAIF,EAGHU,EAAI,EACR,IAAMC,EAAI,EAAGA,EAAID,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E,EAAEJ,EAAEK,CAAE,EAAQR,EAAEO,EAAG,CAAC,EAAEJ,EAAEK,EAAG,CAAC,EAAQR,EAAEO,EAAG,CAAC,EAAEJ,EAAEK,EAAG,CAAC,EAAQR,EAAEO,EAAG,CAAC,EAAEJ,EAAEK,EAAG,CAAC,EAAQR,EAAEO,EAAG,CAAC,EAAEJ,EAAEK,EAAG,CAAC,EAC3GD,GAAMV,EACNW,GAAMX,EAEP,OAAOS,CACR,CACA,IAAMI,EAAI,EAAGA,EAAIX,EAAGW,IACnBJ,GAAON,EAAGO,CAAG,EAAIJ,EAAGK,CAAG,EACvBD,GAAMN,EACNO,GAAMJ,EAEP,OAAOE,CACR,CAKAV,EAAO,QAAUE,IC/FjB,IAAAa,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAc,QAAS,uDAAwD,EAC/EC,EAAQ,IACRC,EAAU,IAKdF,EAAaC,EAAO,UAAWC,CAAQ,EAKvCH,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,EAAQD,EAERC,EAAQC,EAMT,OAAO,QAAUD", - "names": ["require_dsdot", "__commonJSMin", "exports", "module", "M", "dsdot", "N", "x", "strideX", "y", "strideY", "dot", "ix", "iy", "m", "i", "require_ndarray", "__commonJSMin", "exports", "module", "M", "dsdot", "N", "x", "strideX", "offsetX", "y", "strideY", "offsetY", "dot", "ix", "iy", "m", "i", "require_main", "__commonJSMin", "exports", "module", "setReadOnly", "dsdot", "ndarray", "join", "tryRequire", "isError", "main", "dsdot", "tmp"] + "sources": ["../lib/ndarray.js", "../lib/dsdot.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// VARIABLES //\n\nvar M = 5;\n\n\n// MAIN //\n\n/**\n* Computes the dot product of `x` and `y` with extended accumulation and result.\n*\n* @param {integer} N - number of indexed elements\n* @param {Float32Array} x - first input array\n* @param {integer} strideX - `x` stride length\n* @param {NonNegativeInteger} offsetX - starting index for `x`\n* @param {Float32Array} y - second input array\n* @param {integer} strideY - `y` stride length\n* @param {NonNegativeInteger} offsetY - starting index for `y`\n* @returns {number} dot product\n*\n* @example\n* var Float32Array = require( '@stdlib/array-float32' );\n*\n* var x = new Float32Array( [ 4.0, 2.0, -3.0, 5.0, -1.0 ] );\n* var y = new Float32Array( [ 2.0, 6.0, -1.0, -4.0, 8.0 ] );\n*\n* var z = dsdot( x.length, x, 1, 0, y, 1, 0 );\n* // returns -5.0\n*/\nfunction dsdot( N, x, strideX, offsetX, y, strideY, offsetY ) {\n\tvar dot;\n\tvar ix;\n\tvar iy;\n\tvar m;\n\tvar i;\n\n\tdot = 0.0;\n\tif ( N <= 0 ) {\n\t\treturn dot;\n\t}\n\tix = offsetX;\n\tiy = offsetY;\n\n\t// Use unrolled loops if both strides are equal to `1`...\n\tif ( strideX === 1 && strideY === 1 ) {\n\t\tm = N % M;\n\n\t\t// If we have a remainder, run a clean-up loop...\n\t\tif ( m > 0 ) {\n\t\t\tfor ( i = 0; i < m; i++ ) {\n\t\t\t\tdot += x[ ix ] * y[ iy ];\n\t\t\t\tix += 1;\n\t\t\t\tiy += 1;\n\t\t\t}\n\t\t}\n\t\tif ( N < M ) {\n\t\t\treturn dot;\n\t\t}\n\t\tfor ( i = m; i < N; i += M ) {\n\t\t\tdot += ( x[ix]*y[iy] ) + ( x[ix+1]*y[iy+1] ) + ( x[ix+2]*y[iy+2] ) + ( x[ix+3]*y[iy+3] ) + ( x[ix+4]*y[iy+4] ); // eslint-disable-line max-len\n\t\t\tix += M;\n\t\t\tiy += M;\n\t\t}\n\t\treturn dot;\n\t}\n\tfor ( i = 0; i < N; i++ ) {\n\t\tdot += x[ ix ] * y[ iy ];\n\t\tix += strideX;\n\t\tiy += strideY;\n\t}\n\treturn dot;\n}\n\n\n// EXPORTS //\n\nmodule.exports = dsdot;\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 dot product of `x` and `y` with extended accumulation and result.\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {Float32Array} x - first input array\n* @param {integer} strideX - `x` stride length\n* @param {Float32Array} y - second input array\n* @param {integer} strideY - `y` stride length\n* @returns {number} dot product\n*\n* @example\n* var Float32Array = require( '@stdlib/array-float32' );\n*\n* var x = new Float32Array( [ 4.0, 2.0, -3.0, 5.0, -1.0 ] );\n* var y = new Float32Array( [ 2.0, 6.0, -1.0, -4.0, 8.0 ] );\n*\n* var z = dsdot( x.length, x, 1, y, 1 );\n* // returns -5.0\n*/\nfunction dsdot( N, x, strideX, y, strideY ) {\n\tvar ix;\n\tvar iy;\n\tif ( N <= 0 ) {\n\t\treturn 0.0;\n\t}\n\tix = stride2offset( N, strideX );\n\tiy = stride2offset( N, strideY );\n\treturn ndarray( N, x, strideX, ix, y, strideY, iy );\n}\n\n\n// EXPORTS //\n\nmodule.exports = dsdot;\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 dsdot = require( './dsdot.js' );\nvar ndarray = require( './ndarray.js' );\n\n\n// MAIN //\n\nsetReadOnly( dsdot, 'ndarray', ndarray );\n\n\n// EXPORTS //\n\nmodule.exports = dsdot;\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* BLAS level 1 routine to compute the dot product of vectors `x` and `y` with extended accumulation and result.\n*\n* @module @stdlib/blas-base-dsdot\n*\n* @example\n* var Float32Array = require( '@stdlib/array-float32' );\n* var dsdot = require( '@stdlib/blas-base-dsdot' );\n*\n* var x = new Float32Array( [ 4.0, 2.0, -3.0, 5.0, -1.0 ] );\n* var y = new Float32Array( [ 2.0, 6.0, -1.0, -4.0, 8.0 ] );\n*\n* var z = dsdot( x.length, x, 1, y, 1 );\n* // returns -12.0\n*\n* @example\n* var Float32Array = require( '@stdlib/array-float32' );\n* var dsdot = require( '@stdlib/blas-base-dsdot' );\n*\n* var x = new Float32Array( [ 4.0, 2.0, -3.0, 5.0, -1.0 ] );\n* var y = new Float32Array( [ 2.0, 6.0, -1.0, -4.0, 8.0 ] );\n*\n* var z = dsdot.ndarray( x.length, x, 1, 0, y, 1, 0 );\n* // returns -12.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 dsdot;\nvar tmp = tryRequire( join( __dirname, './native.js' ) );\nif ( isError( tmp ) ) {\n\tdsdot = main;\n} else {\n\tdsdot = tmp;\n}\n\n\n// EXPORTS //\n\nmodule.exports = dsdot;\n\n// exports: { \"ndarray\": \"dsdot.ndarray\" }\n"], + "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAI,EA0BR,SAASC,EAAOC,EAAGC,EAAGC,EAASC,EAASC,EAAGC,EAASC,EAAU,CAC7D,IAAIC,EACAC,EACAC,EACAC,EACAC,EAGJ,GADAJ,EAAM,EACDP,GAAK,EACT,OAAOO,EAMR,GAJAC,EAAKL,EACLM,EAAKH,EAGAJ,IAAY,GAAKG,IAAY,EAAI,CAIrC,GAHAK,EAAIV,EAAIF,EAGHY,EAAI,EACR,IAAMC,EAAI,EAAGA,EAAID,EAAGC,IACnBJ,GAAON,EAAGO,CAAG,EAAIJ,EAAGK,CAAG,EACvBD,GAAM,EACNC,GAAM,EAGR,GAAKT,EAAIF,EACR,OAAOS,EAER,IAAMI,EAAID,EAAGC,EAAIX,EAAGW,GAAKb,EACxBS,GAASN,EAAEO,CAAE,EAAEJ,EAAEK,CAAE,EAAQR,EAAEO,EAAG,CAAC,EAAEJ,E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iy", "m", "i", "require_dsdot", "__commonJSMin", "exports", "module", "stride2offset", "ndarray", "dsdot", "N", "x", "strideX", "y", "strideY", "ix", "iy", "require_main", "__commonJSMin", "exports", "module", "setReadOnly", "dsdot", "ndarray", "join", "tryRequire", "isError", "main", "dsdot", "tmp"] } diff --git a/lib/dsdot.js b/lib/dsdot.js index ee9bc48..cedde22 100644 --- a/lib/dsdot.js +++ b/lib/dsdot.js @@ -18,9 +18,10 @@ 'use strict'; -// VARIABLES // +// MODULES // -var M = 5; +var stride2offset = require( '@stdlib/strided-base-stride2offset' ); +var ndarray = require( './ndarray.js' ); // MAIN // @@ -45,50 +46,14 @@ var M = 5; * // returns -5.0 */ function dsdot( N, x, strideX, y, strideY ) { - var dot; var ix; var iy; - var m; - var i; - - dot = 0.0; if ( N <= 0 ) { - return dot; - } - // Use unrolled loops if both strides are equal to `1`... - if ( strideX === 1 && strideY === 1 ) { - m = N % M; - - // If we have a remainder, run a clean-up loop... - if ( m > 0 ) { - for ( i = 0; i < m; i++ ) { - dot += x[ i ] * y[ i ]; - } - } - if ( N < M ) { - return dot; - } - for ( i = m; i < N; i += M ) { - dot += ( x[i]*y[i] ) + ( x[i+1]*y[i+1] ) + ( x[i+2]*y[i+2] ) + ( x[i+3]*y[i+3] ) + ( x[i+4]*y[i+4] ); // eslint-disable-line max-len - } - return dot; - } - 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++ ) { - dot += x[ ix ] * y[ iy ]; - ix += strideX; - iy += strideY; + return 0.0; } - return dot; + ix = stride2offset( N, strideX ); + iy = stride2offset( N, strideY ); + return ndarray( N, x, strideX, ix, y, strideY, iy ); } diff --git a/package.json b/package.json index 47d8e77..4ab30d2 100644 --- a/package.json +++ b/package.json @@ -42,12 +42,13 @@ }, "dependencies": { "@stdlib/assert-is-error": "^0.2.1", - "@stdlib/blas-base-shared": "github:stdlib-js/blas-base-shared#main", + "@stdlib/blas-base-shared": "^0.0.1", "@stdlib/napi-argv": "^0.2.1", "@stdlib/napi-argv-int64": "^0.2.1", "@stdlib/napi-argv-strided-float32array": "^0.2.1", - "@stdlib/napi-create-double": "github:stdlib-js/napi-create-double#main", + "@stdlib/napi-create-double": "^0.0.1", "@stdlib/napi-export": "^0.2.1", + "@stdlib/strided-base-stride2offset": "github:stdlib-js/strided-base-stride2offset#main", "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1", "@stdlib/utils-library-manifest": "^0.2.1", "@stdlib/utils-try-require": "^0.2.1"