Skip to content

Commit

Permalink
chore: apply review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
aman-095 committed Oct 18, 2024
1 parent fdb4afe commit 89b1e9c
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 37 deletions.
6 changes: 3 additions & 3 deletions lib/node_modules/@stdlib/blas/base/idamax-wasm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ The function has the following parameters:
- **x**: input [`Float64Array`][@stdlib/array/float64].
- **strideX**: index increment for `x`.

The `N` and `strideX` parameters determine which elements in `x` are accessed at runtime. For example, to traverse every other value,
The `N` and stride parameters determine which elements in the input strided array are accessed at runtime. For example, to traverse every other value,

```javascript
var Float64Array = require( '@stdlib/array/float64' );
Expand Down Expand Up @@ -95,7 +95,7 @@ The function has the following additional parameters:

- **offsetX**: starting index for `x`.

While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the `offset` parameter supports indexing semantics based on a starting index. For example, to start from the second index,
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameter supports indexing semantics based on a starting index. For example, to start from the second index,

```javascript
var Float64Array = require( '@stdlib/array/float64' );
Expand Down Expand Up @@ -233,7 +233,7 @@ The function has the following additional parameters:

## Notes

- If `N <= 0` the function returns `0.0`.
- If `N < 1`, both `main` and `ndarray` methods return `-1.0`.
- This package implements routines using WebAssembly. When provided arrays which are not allocated on a `idamax` module memory instance, data must be explicitly copied to module memory prior to computation. Data movement may entail a performance cost, and, thus, if you are using arrays external to module memory, you should prefer using [`@stdlib/blas/base/idamax`][@stdlib/blas/base/idamax]. However, if working with arrays which are allocated and explicitly managed on module memory, you can achieve better performance when compared to the pure JavaScript implementations found in [`@stdlib/blas/base/idamax`][@stdlib/blas/base/idamax]. Beware that such performance gains may come at the cost of additional complexity when having to perform manual memory management. Choosing between implementations depends heavily on the particular needs and constraints of your application, with no one choice universally better than the other.
- `idamax()` corresponds to the [BLAS][blas] level 1 function [`idamax`][idamax].

Expand Down
12 changes: 6 additions & 6 deletions lib/node_modules/@stdlib/blas/base/idamax-wasm/docs/repl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
> var idx = {{alias}}.main( x.length, x, 1 )
1

// Using `N` and `stride` parameters:
// Using `N` and stride parameters:
> x = new {{alias:@stdlib/array/float64}}( [ -2.0, 1.0, 1.0, -5.0, 2.0, -1.0 ] );
> idx = {{alias}}.main( 6, x, 1 )
3
> idx = {{alias}}.main( 6, x, -1 )
2

// Using view offsets:
> var x0 = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ] );
Expand Down Expand Up @@ -253,9 +253,9 @@
Reallocates the underlying WebAssembly memory instance to a specified number
of bytes.

WebAssembly memory can only **grow**, not shrink. Hence, if provided a
number of bytes which is less than or equal to the size of the current
memory, the function does nothing.
WebAssembly memory can only *grow*, not shrink. Hence, if provided a number
of bytes which is less than or equal to the size of the current memory, the
function does nothing.

When non-shared memory is resized, the underlying the `ArrayBuffer` is
detached, consequently invalidating any associated typed array views. Before
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ interface ModuleConstructor {
* });
*
* // Create a BLAS routine:
* var idamax = new idamax.Module( mem );
* var mod = new idamax.Module( mem );
* // returns <Module>
*
* // Initialize the routine:
* idamax.initializeSync();
* mod.initializeSync();
*
* // Define a vector data type:
* var dtype = 'float64';
Expand All @@ -59,10 +59,10 @@ interface ModuleConstructor {
* var xptr = 0;
*
* // Write vector values to module memory:
* idamax.write( xptr, oneTo( N, dtype ) );
* mod.write( xptr, oneTo( N, dtype ) );
*
* // Perform computation:
* var idx = idamax.main( N, xptr, 1 );
* var idx = mod.main( N, xptr, 1 );
* // returns 4
*/
new( mem: Memory ): Module; // newable
Expand All @@ -84,11 +84,11 @@ interface ModuleConstructor {
* });
*
* // Create a BLAS routine:
* var idamax = idamax.Module( mem );
* var mod = idamax.Module( mem );
* // returns <Module>
*
* // Initialize the routine:
* idamax.initializeSync();
* mod.initializeSync();
*
* // Define a vector data type:
* var dtype = 'float64';
Expand All @@ -100,10 +100,10 @@ interface ModuleConstructor {
* var xptr = 0;
*
* // Write vector values to module memory:
* idamax.write( xptr, oneTo( N, dtype ) );
*mod.write( xptr, oneTo( N, dtype ) );
*
* // Perform computation:
* var idx = idamax.main( N, xptr, 1 );
* var idx = mod.main( N, xptr, 1 );
* // returns 4
*/
( mem: Memory ): Module; // callable
Expand Down Expand Up @@ -132,11 +132,11 @@ interface Module extends ModuleWrapper {
* });
*
* // Create a BLAS routine:
* var idamax = new Module( mem );
* var mod = new idamax.Module( mem );
* // returns <Module>
*
* // Initialize the routine:
* idamax.initializeSync();
* mod.initializeSync();
*
* // Define a vector data type:
* var dtype = 'float64';
Expand All @@ -148,10 +148,10 @@ interface Module extends ModuleWrapper {
* var xptr = 0;
*
* // Write vector values to module memory:
* idamax.write( xptr, oneTo( N, dtype ) );
* mod.write( xptr, oneTo( N, dtype ) );
*
* // Perform computation:
* var idx = idamax.main( N, xptr, 1 );
* var idx = mod.main( N, xptr, 1 );
* // returns 4
*/
main( N: number, xptr: number, strideX: number ): number;
Expand All @@ -176,11 +176,11 @@ interface Module extends ModuleWrapper {
* });
*
* // Create a BLAS routine:
* var idamax = new Module( mem );
* var mod = new idamax.Module( mem );
* // returns <Module>
*
* // Initialize the routine:
* idamax.initializeSync();
* mod.initializeSync();
*
* // Define a vector data type:
* var dtype = 'float64';
Expand All @@ -192,10 +192,10 @@ interface Module extends ModuleWrapper {
* var xptr = 0;
*
* // Write vector values to module memory:
* idamax.write( xptr, oneTo( N, dtype ) );
* mod.write( xptr, oneTo( N, dtype ) );
*
* // Perform computation:
* var idx = idamax.ndarray( N, xptr, 1, 0 );
* var idx = mod.ndarray( N, xptr, 1, 0 );
* // returns 4
*/
ndarray( N: number, xptr: number, strideX: number, offsetX: number ): number;
Expand Down Expand Up @@ -259,11 +259,11 @@ interface Routine extends ModuleWrapper {
* });
*
* // Create a BLAS routine:
* var idamax = new idamax.Module( mem );
* var mod = new idamax.Module( mem );
* // returns <Module>
*
* // Initialize the routine:
* idamax.initializeSync();
* mod.initializeSync();
*
* // Define a vector data type:
* var dtype = 'float64';
Expand All @@ -275,10 +275,10 @@ interface Routine extends ModuleWrapper {
* var xptr = 0;
*
* // Write vector values to module memory:
* idamax.write( xptr, oneTo( N, dtype ) );
* mod.write( xptr, oneTo( N, dtype ) );
*
* // Perform computation:
* var idx = idamax.main( N, xptr, 1 );
* var idx = mod.main( N, xptr, 1 );
* // returns 4
*/
Module: ModuleConstructor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function main() {
// Perform computation:
var idx = mod.ndarray( N, xptr, 1, 0 );

// Read out the result:
// Print the result:
console.log( idx );
}

Expand Down
4 changes: 1 addition & 3 deletions lib/node_modules/@stdlib/blas/base/idamax-wasm/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@
*
* // Perform computation:
* var idx = mod.main( N, xptr, 1 );
*
* // Read out the results:
* console.log( idx );
* // returns 4
*/

// MODULES //
Expand Down
8 changes: 4 additions & 4 deletions lib/node_modules/@stdlib/blas/base/idamax-wasm/lib/routine.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var Module = require( './module.js' );
* // Initialize the module:
* idamax.initializeSync();
*
* // Define strided arrays:
* // Define a strided array:
* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, -5.0 ] );
*
* // Perform operation:
Expand All @@ -65,7 +65,7 @@ var Module = require( './module.js' );
* // Initialize the module:
* idamax.initializeSync();
*
* // Define strided arrays:
* // Define a strided array:
* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, -5.0 ] );
*
* // Perform operation:
Expand Down Expand Up @@ -106,7 +106,7 @@ inherits( Routine, Module );
* // Initialize the module:
* idamax.initializeSync();
*
* // Define strided arrays:
* // Define a strided array:
* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, -5.0 ] );
*
* // Perform operation:
Expand Down Expand Up @@ -139,7 +139,7 @@ setReadOnly( Routine.prototype, 'main', function idamax( N, x, strideX ) {
* // Initialize the module:
* idamax.initializeSync();
*
* // Define strided arrays:
* // Define a strided array:
* var x = new Float64Array( [ 1.0, 2.0, -3.0, 4.0, -5.0 ] );
*
* // Perform operation:
Expand Down

0 comments on commit 89b1e9c

Please sign in to comment.