blas-base-wasm-sswap
Interchange two single-precision floating-point vectors.
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.2%) to scientific vocabulary
Keywords
Repository
Interchange two single-precision floating-point vectors.
Basic Info
- Host: GitHub
- Owner: yarikkyzym
- License: apache-2.0
- Language: JavaScript
- Default Branch: main
- Size: 75.2 KB
Statistics
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 1
Topics
Metadata Files
README.md
🧮 BLAS Base WASM SSwap
Interchange two single-precision floating-point vectors with ease using this efficient and straightforward implementation of the SSwap subroutine.
Table of Contents
Introduction
The BLAS Base WASM SSwap library is designed for developers who need to swap two vectors of single-precision floating-point numbers. This library leverages WebAssembly for speed and efficiency, making it suitable for high-performance applications in web environments.
The main operation is simple: given two vectors, this library will interchange their elements. This operation is fundamental in various mathematical and computational tasks, particularly in linear algebra.
You can find the latest releases here. Download the necessary files and execute them to get started.
Installation
To install the library, you can use npm. Run the following command in your project directory:
bash
npm install blas-base-wasm-sswap
This command will add the library to your project, making it available for use in your JavaScript code.
Usage
Once you have installed the library, you can import it into your JavaScript project. Here’s a basic example of how to use the SSwap function:
```javascript import { sswap } from 'blas-base-wasm-sswap';
// Define two vectors const vectorA = new Float32Array([1.0, 2.0, 3.0]); const vectorB = new Float32Array([4.0, 5.0, 6.0]);
// Swap the vectors sswap(vectorA.length, vectorA, 1, vectorB, 1);
// Output the swapped vectors console.log('Vector A:', vectorA); // [4.0, 5.0, 6.0] console.log('Vector B:', vectorB); // [1.0, 2.0, 3.0] ```
Function Signature
The sswap function has the following signature:
javascript
sswap(n, x, incx, y, incy);
n: Number of elements in each vector.x: First vector (Float32Array).incx: Increment for the first vector.y: Second vector (Float32Array).incy: Increment for the second vector.
Important Notes
- Ensure that both vectors are of the same length.
- The increments (
incxandincy) determine how many positions to skip in the vectors. A value of1means no skipping.
Examples
Example 1: Basic Swap
Here’s a simple example demonstrating the swap of two vectors:
```javascript const a = new Float32Array([10, 20, 30]); const b = new Float32Array([40, 50, 60]);
sswap(a.length, a, 1, b, 1);
console.log(a); // [40, 50, 60] console.log(b); // [10, 20, 30] ```
Example 2: Using Different Increments
You can also use different increments for more complex operations:
```javascript const a = new Float32Array([1, 2, 3, 4]); const b = new Float32Array([5, 6, 7, 8]);
sswap(2, a, 2, b, 1);
console.log(a); // [1, 6, 3, 8] console.log(b); // [5, 2, 7, 4] ```
In this example, the first element of a is swapped with the first element of b, while the second element of a is skipped.
Performance
The SSwap function is optimized for performance, especially when used in a WebAssembly context. The use of WebAssembly allows for near-native execution speed, making it suitable for applications requiring high performance.
Benchmarking
We encourage users to benchmark the performance of the SSwap function in their specific use cases. You can use libraries like Benchmark.js to compare it against other implementations.
Contributing
We welcome contributions to improve the library. If you want to contribute, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and commit them.
- Push your branch to your fork.
- Create a pull request.
Please ensure that your code adheres to the existing style and includes tests where applicable.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Contact
For any questions or feedback, feel free to reach out:
- GitHub: yarikkyzym
- Email: yarikkyzym@example.com
For more information and updates, check the Releases section.
Thank you for using BLAS Base WASM SSwap! Happy coding!
Owner
- Login: yarikkyzym
- Kind: user
- Repositories: 1
- Profile: https://github.com/yarikkyzym
Citation (CITATION.cff)
cff-version: 1.2.0
title: stdlib
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software
authors:
- name: The Stdlib Authors
url: https://github.com/stdlib-js/stdlib/graphs/contributors
repository-code: https://github.com/stdlib-js/stdlib
url: https://stdlib.io
abstract: |
Standard library for JavaScript and Node.js.
keywords:
- JavaScript
- Node.js
- TypeScript
- standard library
- scientific computing
- numerical computing
- statistical computing
license: Apache-2.0 AND BSL-1.0
date-released: 2016
GitHub Events
Total
- Release event: 1
- Watch event: 1
- Push event: 750
- Create event: 3
Last Year
- Release event: 1
- Watch event: 1
- Push event: 750
- Create event: 3
Dependencies
- @stdlib/array-float32 ^0.2.2 development
- @stdlib/array-little-endian-float32 github:stdlib-js/array-little-endian-float32#main development
- @stdlib/array-one-to ^0.2.2 development
- @stdlib/array-ones ^0.2.1 development
- @stdlib/array-zeros ^0.2.2 development
- @stdlib/assert-has-wasm-support ^0.2.2 development
- @stdlib/bench-harness ^0.2.2 development
- @stdlib/blas-ext-base-gfill ^0.2.1 development
- @stdlib/blas-ext-base-gfill-by ^0.2.1 development
- @stdlib/fs-read-file ^0.2.2 development
- @stdlib/fs-write-file ^0.2.2 development
- @stdlib/math-base-assert-is-nan ^0.2.2 development
- @stdlib/math-base-special-pow ^0.3.0 development
- @stdlib/ndarray-base-bytes-per-element ^0.2.2 development
- @stdlib/random-array-uniform ^0.2.1 development
- @stdlib/random-base-discrete-uniform ^0.2.1 development
- @stdlib/string-base-base64-to-uint8array github:stdlib-js/string-base-base64-to-uint8array#main development
- @stdlib/string-replace ^0.2.2 development
- @stdlib/time-current-year ^0.2.2 development
- istanbul ^0.4.1 development
- tap-min git+https://github.com/Planeshifter/tap-min.git development
- tape git+https://github.com/kgryte/tape.git#fix/globby development
- @stdlib/assert-is-wasm-memory github:stdlib-js/assert-is-wasm-memory#main
- @stdlib/blas-base-sswap ^0.2.2
- @stdlib/error-tools-fmtprodmsg ^0.2.2
- @stdlib/fs-read-wasm ^0.2.2
- @stdlib/strided-base-read-dataview github:stdlib-js/strided-base-read-dataview#main
- @stdlib/strided-base-stride2offset ^0.1.0
- @stdlib/string-format ^0.2.2
- @stdlib/types ^0.4.3
- @stdlib/utils-define-nonenumerable-read-only-property ^0.2.2
- @stdlib/utils-inherit ^0.2.2
- @stdlib/utils-library-manifest ^0.2.2
- @stdlib/wasm-base-arrays2ptrs github:stdlib-js/wasm-base-arrays2ptrs#main
- @stdlib/wasm-base-strided2object github:stdlib-js/wasm-base-strided2object#main
- @stdlib/wasm-memory github:stdlib-js/wasm-memory#main
- @stdlib/wasm-module-wrapper github:stdlib-js/wasm-module-wrapper#main