Skip to content

Commit

Permalink
refactor: update implementation according to current project conventions
Browse files Browse the repository at this point in the history
Ref: #788
  • Loading branch information
kgryte committed Dec 4, 2023
1 parent 11a8792 commit a86fb6b
Show file tree
Hide file tree
Showing 11 changed files with 197 additions and 177 deletions.
1 change: 0 additions & 1 deletion lib/node_modules/@stdlib/blas/base/sdsdot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ Note that indexing is relative to the first index. To introduce an offset, use [

```javascript
var Float32Array = require( '@stdlib/array/float32' );
var floor = require( '@stdlib/math/base/special/floor' );

// Initial arrays...
var x0 = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
Expand Down
18 changes: 9 additions & 9 deletions lib/node_modules/@stdlib/blas/base/sdsdot/docs/repl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Indexing is relative to the first index. To introduce an offset, use a typed
array view.

If `N <= 0` the function returns `scalar`.
If `N <= 0` the function returns the provided scalar constant.

Parameters
----------
Expand All @@ -33,29 +33,29 @@

Returns
-------
dot: number
out: number
The dot product.

Examples
--------
// Standard usage:
> var x = new {{alias:@stdlib/array/float32}}( [ 4.0, 2.0, -3.0, 5.0, -1.0 ] );
> var y = new {{alias:@stdlib/array/float32}}( [ 2.0, 6.0, -1.0, -4.0, 8.0 ] );
> var dot = {{alias}}( x.length, 0.0, x, 1, y, 1 )
> var out = {{alias}}( x.length, 0.0, x, 1, y, 1 )
-5.0

// Strides:
> x = new {{alias:@stdlib/array/float32}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
> y = new {{alias:@stdlib/array/float32}}( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] );
> dot = {{alias}}( 3, 0.0, x, 2, y, -1 )
> out = {{alias}}( 3, 0.0, x, 2, y, -1 )
9.0

// Using view offsets:
> x = new {{alias:@stdlib/array/float32}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
> y = new {{alias:@stdlib/array/float32}}( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );
> var x1 = new {{alias:@stdlib/array/float32}}( x.buffer, x.BYTES_PER_ELEMENT*1 );
> var y1 = new {{alias:@stdlib/array/float32}}( y.buffer, y.BYTES_PER_ELEMENT*3 );
> dot = {{alias}}( 3, 0.0, x1, -2, y1, 1 )
> out = {{alias}}( 3, 0.0, x1, -2, y1, 1 )
128.0


Expand Down Expand Up @@ -94,27 +94,27 @@

Returns
-------
dot: number
out: number
The dot product.

Examples
--------
// Standard usage:
> var x = new {{alias:@stdlib/array/float32}}( [ 4.0, 2.0, -3.0, 5.0, -1.0 ] );
> var y = new {{alias:@stdlib/array/float32}}( [ 2.0, 6.0, -1.0, -4.0, 8.0 ] );
> var dot = {{alias}}.ndarray( x.length, 0.0, x, 1, 0, y, 1, 0 )
> var out = {{alias}}.ndarray( x.length, 0.0, x, 1, 0, y, 1, 0 )
-5.0

// Strides:
> x = new {{alias:@stdlib/array/float32}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
> y = new {{alias:@stdlib/array/float32}}( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] );
> dot = {{alias}}.ndarray( 3, 0.0, x, 2, 0, y, 2, 0 )
> out = {{alias}}.ndarray( 3, 0.0, x, 2, 0, y, 2, 0 )
9.0

// Using offset indices:
> x = new {{alias:@stdlib/array/float32}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
> y = new {{alias:@stdlib/array/float32}}( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );
> dot = {{alias}}.ndarray( 3, 0.0, x, -2, x.length-1, y, 1, 3 )
> out = {{alias}}.ndarray( 3, 0.0, x, -2, x.length-1, y, 1, 3 )
128.0

References
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

int main( void ) {
// Create strided arrays:
const float x[] = { 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, -8.0 };
const float y[] = { 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, -8.0 };
const float x[] = { 1.0f, -2.0f, 3.0f, -4.0f, 5.0f, -6.0f, 7.0f, -8.0f };
const float y[] = { 1.0f, -2.0f, 3.0f, -4.0f, 5.0f, -6.0f, 7.0f, -8.0f };

// Specify the number of indexed elements:
const int N = 8;
Expand Down
Loading

0 comments on commit a86fb6b

Please sign in to comment.