Skip to content

Commit 20303f7

Browse files
committed
chore: modernize examples and benchmarks
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed ---
1 parent e2618f8 commit 20303f7

7 files changed

Lines changed: 27 additions & 61 deletions

File tree

lib/node_modules/@stdlib/blas/base/ndarray/zcopy/README.md

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,10 @@ var zcopy = require( '@stdlib/blas/base/ndarray/zcopy' );
4141
Copies values from a one-dimensional double-precision complex floating-point ndarray `x` into a one-dimensional double-precision complex floating-point ndarray `y`.
4242

4343
```javascript
44-
var Complex128Array = require( '@stdlib/array/complex128' );
45-
var ndarray = require( '@stdlib/ndarray/base/ctor' );
44+
var Complex128Vector = require( '@stdlib/ndarray/vector/complex128' );
4645

47-
var xbuf = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
48-
var x = new ndarray( 'complex128', xbuf, [ 3 ], [ 1 ], 0, 'row-major' );
49-
50-
var ybuf = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
51-
var y = new ndarray( 'complex128', ybuf, [ 3 ], [ 1 ], 0, 'row-major' );
46+
var x = new Complex128Vector( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
47+
var y = new Complex128Vector( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
5248

5349
var z = zcopy( [ x, y ] );
5450
// returns <ndarray>[ <Complex128>[ 1.0, 2.0 ], <Complex128>[ 3.0, 4.0 ], <Complex128>[ 5.0, 6.0 ] ]
@@ -59,7 +55,10 @@ var bool = ( y === z );
5955

6056
The function has the following parameters:
6157

62-
- **arrays**: array-like object containing an input ndarray and an output ndarray.
58+
- **arrays**: array-like object containing the following ndarrays in order:
59+
60+
- input ndarray
61+
- output ndarray
6362

6463
</section>
6564

@@ -79,21 +78,18 @@ The function has the following parameters:
7978

8079
```javascript
8180
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
82-
var Complex128Array = require( '@stdlib/array/complex128' );
83-
var ndarray = require( '@stdlib/ndarray/base/ctor' );
81+
var Complex128Vector = require( '@stdlib/ndarray/vector/complex128' );
8482
var ndarray2array = require( '@stdlib/ndarray/to-array' );
8583
var zcopy = require( '@stdlib/blas/base/ndarray/zcopy' );
8684

8785
var opts = {
8886
'dtype': 'float64'
8987
};
9088

91-
var xbuf = new Complex128Array( discreteUniform( 10, 0, 100, opts ) );
92-
var x = new ndarray( 'complex128', xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' );
89+
var x = new Complex128Vector( discreteUniform( 10, 0, 100, opts ) );
9390
console.log( ndarray2array( x ) );
9491

95-
var ybuf = new Complex128Array( discreteUniform( xbuf.length*2, 0, 10, opts ) );
96-
var y = new ndarray( 'complex128', ybuf, [ ybuf.length ], [ 1 ], 0, 'row-major' );
92+
var y = new Complex128Vector( discreteUniform( 10, 0, 10, opts ) );
9793
console.log( ndarray2array( y ) );
9894

9995
var out = zcopy( [ x, y ] );

lib/node_modules/@stdlib/blas/base/ndarray/zcopy/benchmark/benchmark.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,12 @@ var uniform = require( '@stdlib/random/array/uniform' );
2525
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2626
var real = require( '@stdlib/complex/float64/real' );
2727
var pow = require( '@stdlib/math/base/special/pow' );
28-
var ndarray = require( '@stdlib/ndarray/base/ctor' );
29-
var Complex128Array = require( '@stdlib/array/complex128' );
28+
var Complex128Vector = require( '@stdlib/ndarray/vector/complex128' );
3029
var format = require( '@stdlib/string/format' );
3130
var pkg = require( './../package.json' ).name;
3231
var zcopy = require( './../lib' );
3332

3433

35-
// VARIABLES //
36-
37-
var options = {
38-
'dtype': 'complex128'
39-
};
40-
41-
4234
// FUNCTIONS //
4335

4436
/**
@@ -57,12 +49,12 @@ function createBenchmark( len ) {
5749
xbuf = uniform( len*2, -100.0, 100.0, {
5850
'dtype': 'float64'
5951
});
60-
x = new ndarray( options.dtype, new Complex128Array( xbuf ), [ len ], [ 1 ], 0, 'row-major' );
52+
x = new Complex128Vector( xbuf.buffer );
6153

6254
ybuf = uniform( len*2, -100.0, 100.0, {
6355
'dtype': 'float64'
6456
});
65-
y = new ndarray( options.dtype, new Complex128Array( ybuf ), [ len ], [ 1 ], 0, 'row-major' );
57+
y = new Complex128Vector( ybuf.buffer );
6658

6759
return benchmark;
6860

lib/node_modules/@stdlib/blas/base/ndarray/zcopy/docs/repl.txt

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,8 @@
1919

2020
Examples
2121
--------
22-
> var xbuf = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0 ] );
23-
> var ybuf = new {{alias:@stdlib/array/complex128}}( [ 0.0, 0.0, 0.0, 0.0 ] );
24-
> var dt = 'complex128';
25-
> var sh = [ xbuf.length ];
26-
> var st = [ 1 ];
27-
> var oo = 0;
28-
> var ord = 'row-major';
29-
> var x = new {{alias:@stdlib/ndarray/ctor}}( dt, xbuf, sh, st, oo, ord );
30-
> var y = new {{alias:@stdlib/ndarray/ctor}}( dt, ybuf, sh, st, oo, ord );
22+
> var x = new {{alias:@stdlib/ndarray/vector/complex128}}( [ 1.0, 2.0, 3.0, 4.0 ] );
23+
> var y = new {{alias:@stdlib/ndarray/vector/complex128}}( [ 0.0, 0.0, 0.0, 0.0 ] );
3124

3225
> {{alias}}( [ x, y ] );
3326
> y

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,10 @@ import { complex128ndarray } from '@stdlib/types/ndarray';
2929
* @returns output ndarray
3030
*
3131
* @example
32-
* var Complex128Array = require( '@stdlib/array/complex128' );
33-
* var ndarray = require( '@stdlib/ndarray/base/ctor' );
32+
* var Complex128Vector = require( '@stdlib/ndarray/vector/complex128' );
3433
*
35-
* var xbuf = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
36-
* var x = new ndarray( 'complex128', xbuf, [ 3 ], [ 1 ], 0, 'row-major' );
37-
*
38-
* var ybuf = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
39-
* var y = new ndarray( 'complex128', ybuf, [ 3 ], [ 1 ], 0, 'row-major' );
34+
* var x = new Complex128Vector( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
35+
* var y = new Complex128Vector( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
4036
*
4137
* var z = zcopy( [ x, y ] );
4238
* // returns <ndarray>[ <Complex128>[ 1.0, 2.0 ], <Complex128>[ 3.0, 4.0 ], <Complex128>[ 5.0, 6.0 ] ]

lib/node_modules/@stdlib/blas/base/ndarray/zcopy/examples/index.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,18 @@
1919
'use strict';
2020

2121
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
22-
var Complex128Array = require( '@stdlib/array/complex128' );
23-
var ndarray = require( '@stdlib/ndarray/base/ctor' );
22+
var Complex128Vector = require( '@stdlib/ndarray/vector/complex128' );
2423
var ndarray2array = require( '@stdlib/ndarray/to-array' );
2524
var zcopy = require( './../lib' );
2625

2726
var opts = {
2827
'dtype': 'float64'
2928
};
3029

31-
var xbuf = new Complex128Array( discreteUniform( 10, 0, 100, opts ) );
32-
var x = new ndarray( 'complex128', xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' );
30+
var x = new Complex128Vector( discreteUniform( 10, 0, 100, opts ) );
3331
console.log( ndarray2array( x ) );
3432

35-
var ybuf = new Complex128Array( discreteUniform( xbuf.length*2, 0, 10, opts ) );
36-
var y = new ndarray( 'complex128', ybuf, [ ybuf.length ], [ 1 ], 0, 'row-major' );
33+
var y = new Complex128Vector( discreteUniform( 10, 0, 10, opts ) );
3734
console.log( ndarray2array( y ) );
3835

3936
var out = zcopy( [ x, y ] );

lib/node_modules/@stdlib/blas/base/ndarray/zcopy/lib/index.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,11 @@
2424
* @module @stdlib/blas/base/ndarray/zcopy
2525
*
2626
* @example
27-
* var Complex128Array = require( '@stdlib/array/complex128' );
28-
* var ndarray = require( '@stdlib/ndarray/base/ctor' );
27+
* var Complex128Vector = require( '@stdlib/ndarray/vector/complex128' );
2928
* var zcopy = require( '@stdlib/blas/base/ndarray/zcopy' );
3029
*
31-
* var xbuf = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
32-
* var x = new ndarray( 'complex128', xbuf, [ 3 ], [ 1 ], 0, 'row-major' );
33-
*
34-
* var ybuf = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
35-
* var y = new ndarray( 'complex128', ybuf, [ 3 ], [ 1 ], 0, 'row-major' );
30+
* var x = new Complex128Vector( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
31+
* var y = new Complex128Vector( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
3632
*
3733
* var z = zcopy( [ x, y ] );
3834
* // returns <ndarray>[ <Complex128>[ 1.0, 2.0 ], <Complex128>[ 3.0, 4.0 ], <Complex128>[ 5.0, 6.0 ] ]

lib/node_modules/@stdlib/blas/base/ndarray/zcopy/lib/main.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,10 @@ var strided = require( '@stdlib/blas/base/zcopy' ).ndarray;
3636
* @returns {Object} output ndarray
3737
*
3838
* @example
39-
* var Complex128Array = require( '@stdlib/array/complex128' );
40-
* var ndarray = require( '@stdlib/ndarray/base/ctor' );
39+
* var Complex128Vector = require( '@stdlib/ndarray/vector/complex128' );
4140
*
42-
* var xbuf = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
43-
* var x = new ndarray( 'complex128', xbuf, [ 3 ], [ 1 ], 0, 'row-major' );
44-
*
45-
* var ybuf = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
46-
* var y = new ndarray( 'complex128', ybuf, [ 3 ], [ 1 ], 0, 'row-major' );
41+
* var x = new Complex128Vector( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
42+
* var y = new Complex128Vector( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
4743
*
4844
* var z = zcopy( [ x, y ] );
4945
* // returns <ndarray>[ <Complex128>[ 1.0, 2.0 ], <Complex128>[ 3.0, 4.0 ], <Complex128>[ 5.0, 6.0 ] ]

0 commit comments

Comments
 (0)