Skip to content

Commit fccb0d5

Browse files
committed
chore: update implementation
1 parent b566bb2 commit fccb0d5

File tree

8 files changed

+31
-21
lines changed

8 files changed

+31
-21
lines changed

lib/node_modules/@stdlib/blas/base/grot/README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ grot.ndarray( 3, x, 2, 1, y, 2, 1, 0.8, 0.6 );
136136
## Notes
137137

138138
- If `N <= 0`, both functions leave `x` and `y` unchanged.
139-
- `grot()` corresponds to the [BLAS][blas] level 1 function [`grot`][grot].
139+
- `grot()` corresponds to the [BLAS][blas] level 1 function [`drot`][drot] with the exception that this implementation works with any array type, not just Float64Arrays. Depending on the environment, the typed versions ([`drot`][@stdlib/blas/base/drot], [`srot`][@stdlib/blas/base/srot], etc.) are likely to be significantly more performant.
140+
- Both functions support array-like objects having getter and setter accessors for array element access (e.g., [`@stdlib/array/base/accessor`][@stdlib/array/base/accessor]).
140141

141142
</section>
142143

@@ -185,8 +186,16 @@ console.log( y );
185186

186187
[blas]: http://www.netlib.org/blas
187188

189+
[drot]: https://www.netlib.org/lapack/explore-html-3.6.1/de/da4/group__double__blas__level1_ga54d516b6e0497df179c9831f2554b1f9.html
190+
188191
[mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray
189192

193+
[@stdlib/blas/base/drot]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/drot
194+
195+
[@stdlib/blas/base/srot]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/srot
196+
197+
[@stdlib/array/base/accessor]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/accessor
198+
190199
</section>
191200

192201
<!-- /.links -->

lib/node_modules/@stdlib/blas/base/grot/docs/types/index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ interface Routine {
4747
* var x = [ 1.0, 2.0, 3.0, 4.0, 5.0 ];
4848
* var y = [ 6.0, 7.0, 8.0, 9.0, 10.0 ];
4949
*
50-
* grot( x.length, x, 1, y, 1, 0.8, 0.6 );
50+
* grot( 5, x, 1, y, 1, 0.8, 0.6 );
5151
* // x => [ ~4.4, ~5.8, 7.2, 8.6, 10.0 ]
5252
* // y => [ ~4.2, 4.4, 4.6, 4.8, 5.0 ]
5353
*/
@@ -94,7 +94,7 @@ interface Routine {
9494
* var x = [ 1.0, 2.0, 3.0, 4.0, 5.0 ];
9595
* var y = [ 6.0, 7.0, 8.0, 9.0, 10.0 ];
9696
*
97-
* grot( x.length, x, 1, y, 1, 0.8, 0.6 );
97+
* grot( 5, x, 1, y, 1, 0.8, 0.6 );
9898
* // x => [ ~4.4, ~5.8, 7.2, 8.6, 10.0 ]
9999
* // y => [ ~4.2, 4.4, ~4.6, ~4.8, 5.0 ]
100100
*

lib/node_modules/@stdlib/blas/base/grot/lib/accessors.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@
5353
function grot( N, x, strideX, offsetX, y, strideY, offsetY, c, s ) {
5454
var xbuf;
5555
var ybuf;
56+
var xval;
57+
var yval;
5658
var set;
5759
var get;
58-
var tmp;
5960
var ix;
6061
var iy;
6162
var i;
@@ -71,11 +72,11 @@ function grot( N, x, strideX, offsetX, y, strideY, offsetY, c, s ) {
7172
ix = offsetX;
7273
iy = offsetY;
7374
for ( i = 0; i < N; i++ ) {
74-
var xval = get( xbuf, ix );
75-
var yval = get( ybuf, iy );
75+
xval = get( xbuf, ix );
76+
yval = get( ybuf, iy );
7677

77-
set( xbuf, ix, c * xval + s * yval );
78-
set( ybuf, iy, c * yval - s * xval );
78+
set( xbuf, ix, ( c * xval ) + ( s * yval ) );
79+
set( ybuf, iy, ( c * yval ) - ( s * xval ) );
7980
ix += strideX;
8081
iy += strideY;
8182
}

lib/node_modules/@stdlib/blas/base/grot/lib/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
* var x = [ 1.0, 2.0, 3.0, 4.0, 5.0 ];
3030
* var y = [ 6.0, 7.0, 8.0, 9.0, 10.0 ];
3131
*
32-
* grot( 4, x, 1, y, 1, 0.8, 0.6 );
33-
* // x => <Float64Array>[ ~4.4, ~5.8, 7.2, 8.6, 10.0 ]
34-
* // y => <Float64Array>[ ~4.2, 4.4, 4.6, 4.8, 5.0 ]
32+
* grot( 5, x, 1, y, 1, 0.8, 0.6 );
33+
* // x => [ ~4.4, ~5.8, 7.2, 8.6, 10.0 ]
34+
* // y => [ ~4.2, 4.4, 4.6, 4.8, 5.0 ]
3535
*
3636
* @example
3737
* var grot = require( '@stdlib/blas/base/grot' );

lib/node_modules/@stdlib/blas/base/grot/lib/main.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ var ndarray = require( './ndarray.js' );
4242
* var x = [ 1.0, 2.0, 3.0, 4.0, 5.0 ];
4343
* var y = [ 6.0, 7.0, 8.0, 9.0, 10.0 ];
4444
*
45-
* grot( 4, x, 1, y, 1, 0.8, 0.6 );
46-
* // x => <Float64Array>[ ~4.4, ~5.8, 7.2, 8.6, 10.0 ]
47-
* // y => <Float64Array>[ ~4.2, 4.4, 4.6, 4.8, 5.0 ]
45+
* grot( 5, x, 1, y, 1, 0.8, 0.6 );
46+
* // x => [ ~4.4, ~5.8, 7.2, 8.6, 10.0 ]
47+
* // y => [ ~4.2, 4.4, 4.6, 4.8, 5.0 ]
4848
*/
4949
function grot( N, x, strideX, y, strideY, c, s ) {
5050
return ndarray( N, x, strideX, stride2offset( N, strideX ), y, strideY, stride2offset( N, strideY ), c, s ); // eslint-disable-line max-len

lib/node_modules/@stdlib/blas/base/grot/lib/ndarray.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ function grot( N, x, strideX, offsetX, y, strideY, offsetY, c, s ) {
5252
var tmp;
5353
var ix;
5454
var iy;
55-
var ox;
55+
var ox;
5656
var oy;
5757
var i;
5858

5959
if ( N <= 0 ) {
6060
return y;
6161
}
62-
ox = arraylike2object( x );
62+
ox = arraylike2object( x );
6363
oy = arraylike2object( y );
6464
if ( ox.accessorProtocol || oy.accessorProtocol ) {
6565
accessors( N, ox, strideX, offsetX, oy, strideY, offsetY, c, s );

lib/node_modules/@stdlib/blas/base/grot/test/test.main.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -555,10 +555,10 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the function leav
555555
x = [ 1.0, 2.0, 3.0, 4.0, 5.0 ];
556556
y = [ 6.0, 7.0, 8.0, 9.0, 10.0 ];
557557

558-
xe = [ 0.0, 0.0, 0.0, 0.0, 0.0 ]
558+
xe = [ 0.0, 0.0, 0.0, 0.0, 0.0 ];
559559
gcopy( x.length, x, 1, xe, 1 );
560560

561-
ye = [ 0.0, 0.0, 0.0, 0.0, 0.0 ]
561+
ye = [ 0.0, 0.0, 0.0, 0.0, 0.0 ];
562562
gcopy( y.length, y, 1, ye, 1 );
563563

564564
grot( -1, x, 1, y, 1, 0.8, 0.6 );
@@ -581,10 +581,10 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the function leav
581581
x = [ 1.0, 2.0, 3.0, 4.0, 5.0 ];
582582
y = [ 6.0, 7.0, 8.0, 9.0, 10.0 ];
583583

584-
xe = [ 0.0, 0.0, 0.0, 0.0, 0.0 ]
584+
xe = [ 0.0, 0.0, 0.0, 0.0, 0.0 ];
585585
gcopy( x.length, x, 1, xe, 1 );
586586

587-
ye = [ 0.0, 0.0, 0.0, 0.0, 0.0 ]
587+
ye = [ 0.0, 0.0, 0.0, 0.0, 0.0 ];
588588
gcopy( y.length, y, 1, ye, 1 );
589589

590590
grot( -1, toAccessorArray( x ), 1, toAccessorArray( y ), 1, 0.8, 0.6 );

lib/node_modules/@stdlib/blas/base/grot/test/test.ndarray.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -906,4 +906,4 @@ tape( 'the function supports complex access patterns (accessors)', function test
906906
isApprox( t, y, ye, 5.0 );
907907

908908
t.end();
909-
});
909+
});

0 commit comments

Comments
 (0)