Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Sep 25, 2024
1 parent 7d12522 commit f9db968
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<section class="release" id="unreleased">

## Unreleased (2024-09-22)
## Unreleased (2024-09-25)

<section class="features">

Expand All @@ -22,6 +22,7 @@

<details>

- [`3095c9a`](https://github.com/stdlib-js/stdlib/commit/3095c9a511ea9d5291e2af2344b239a6101ab31f) - **docs:** add example using little-endian arrays _(by Athan Reines)_
- [`177f16c`](https://github.com/stdlib-js/stdlib/commit/177f16cd80b9072714e7b4e976487e5e6dd19761) - **chore:** update package meta data [(#2933)](https://github.com/stdlib-js/stdlib/pull/2933) _(by stdlib-bot, Athan Reines)_
- [`b8cc3db`](https://github.com/stdlib-js/stdlib/commit/b8cc3db63853dc4e9b4b949abc36bac20c3bf305) - **test:** use `Module` constructor directly _(by Athan Reines)_
- [`a510e37`](https://github.com/stdlib-js/stdlib/commit/a510e375b6e6f608c7763997ff4abad7d8941f9d) - **test:** add module `ndarray` method tests _(by Athan Reines)_
Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Christopher Dambamuromo <[email protected]>
Dan Rose <[email protected]>
Daniel Killenberger <[email protected]>
Daniel Yu <[email protected]>
DebashisMaharana <[email protected]>
Dominik Moritz <[email protected]>
Dorrin Sotoudeh <[email protected]>
EuniceSim142 <[email protected]>
Expand Down Expand Up @@ -99,6 +100,7 @@ Xiaochuan Ye <[email protected]>
Yernar Yergaziyev <[email protected]>
naveen <[email protected]>
nishant-s7 <[email protected]>
olenkabilonizhka <[email protected]>
orimiles5 <[email protected]>
rainn <[email protected]>
rei2hu <[email protected]>
Expand Down
74 changes: 74 additions & 0 deletions examples/little_endian_arrays.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2024 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

var hasWebAssemblySupport = require( '@stdlib/assert-has-wasm-support' );
var Memory = require( '@stdlib/wasm-memory' );
var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory;
var gfill = require( '@stdlib/blas-ext-base-gfill' );
var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' );
var bytesPerElement = require( '@stdlib/ndarray-base-bytes-per-element' );
var Float64ArrayLE = require( '@stdlib/array-little-endian-float64' );
var daxpy = require( './../lib' );

function main() {
if ( !hasWebAssemblySupport() ) {
console.error( 'Environment does not support WebAssembly.' );
return;
}
// Create a new memory instance with an initial size of 10 pages (640KiB) and a maximum size of 100 pages (6.4MiB):
var mem = new Memory({
'initial': 10,
'maximum': 100
});

// Create a BLAS routine:
var mod = new daxpy.Module( mem );
// returns <Module>

// Initialize the routine:
mod.initializeSync(); // eslint-disable-line node/no-sync

// Define a vector data type:
var dtype = 'float64';

// Specify a vector length:
var N = 5;

// Define pointers (i.e., byte offsets) for storing two vectors:
var xptr = 0;
var yptr = N * bytesPerElement( dtype );

// Create typed array views over module memory:
var x = new Float64ArrayLE( mod.memory.buffer, xptr, N );
var y = new Float64ArrayLE( mod.memory.buffer, yptr, N );

// Write values to module memory:
gfillBy( N, x, 1, discreteUniform( -10.0, 10.0 ) );
gfill( N, 1.0, y, 1 );

// Perform computation:
mod.ndarray( N, 5.0, xptr, 1, 0, yptr, 1, 0 );

// Print the results:
console.log( 'x[:] = [%s]', x.toString() );
console.log( 'y[:] = [%s]', y.toString() );
}

main();
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,20 @@
},
"devDependencies": {
"@stdlib/array-float64": "^0.2.2",
"@stdlib/array-little-endian-float64": "github:stdlib-js/array-little-endian-float64#main",
"@stdlib/array-one-to": "^0.2.2",
"@stdlib/array-ones": "^0.2.1",
"@stdlib/array-zeros": "^0.2.2",
"@stdlib/assert-has-wasm-support": "^0.2.2",
"@stdlib/blas-ext-base-gfill": "^0.2.1",
"@stdlib/blas-ext-base-gfill-by": "^0.2.1",
"@stdlib/fs-read-file": "^0.2.2",
"@stdlib/fs-write-file": "^0.2.2",
"@stdlib/math-base-assert-is-nan": "^0.2.2",
"@stdlib/math-base-special-pow": "^0.3.0",
"@stdlib/ndarray-base-bytes-per-element": "^0.2.2",
"@stdlib/random-array-uniform": "^0.2.1",
"@stdlib/random-base-discrete-uniform": "^0.2.1",
"@stdlib/string-base-base64-to-uint8array": "github:stdlib-js/string-base-base64-to-uint8array#main",
"@stdlib/string-replace": "^0.2.2",
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
Expand Down

0 comments on commit f9db968

Please sign in to comment.