ndarray-vector-uint8c

Create a clamped unsigned 8-bit integer vector (i.e., a one-dimensional ndarray).

https://github.com/laxman44/ndarray-vector-uint8c

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 (15.3%) to scientific vocabulary

Keywords

constructor ctor data javascript ndarray nodejs stdlib structure types uint8c vec vector
Last synced: 6 months ago · JSON representation ·

Repository

Create a clamped unsigned 8-bit integer vector (i.e., a one-dimensional ndarray).

Basic Info
  • Host: GitHub
  • Owner: Laxman44
  • License: apache-2.0
  • Language: JavaScript
  • Default Branch: main
  • Size: 50.8 KB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
constructor ctor data javascript ndarray nodejs stdlib structure types uint8c vec vector
Created 9 months ago · Last pushed 6 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct Citation Security

README.md

🛠️ ndarray-vector-uint8c

Welcome to the ndarray-vector-uint8c repository! This project focuses on creating a clamped unsigned 8-bit integer vector, which is essentially a one-dimensional ndarray. This type of data structure is useful in various applications, especially in image processing, where pixel values are often represented as 8-bit integers.

📦 Table of Contents

📜 Introduction

The ndarray-vector-uint8c library provides an efficient way to handle unsigned 8-bit integer vectors. These vectors can store values ranging from 0 to 255. The clamping feature ensures that any values outside this range are adjusted to fit within it. This makes the library particularly valuable for tasks involving graphics and data manipulation.

The library is built using JavaScript and is compatible with Node.js. It aims to provide a simple yet powerful API for developers who need to work with numeric data efficiently.

You can check the latest releases of this project here.

🚀 Installation

To install the ndarray-vector-uint8c library, you can use npm. Run the following command in your terminal:

bash npm install ndarray-vector-uint8c

This command will download the package and add it to your project's dependencies.

📖 Usage

To use the library, you need to require it in your JavaScript file. Here’s a basic example:

```javascript const { VectorUint8C } = require('ndarray-vector-uint8c');

const vector = new VectorUint8C(10); // Create a vector of length 10 vector.set(0, 255); // Set the first element to 255 console.log(vector.get(0)); // Outputs: 255 ```

Clamping Behavior

The clamping feature automatically adjusts any values that exceed the 0-255 range. For example:

javascript vector.set(1, 300); // Attempt to set value outside the range console.log(vector.get(1)); // Outputs: 255

📚 API Documentation

Constructor

The main constructor for creating a new unsigned 8-bit integer vector is VectorUint8C.

Parameters

  • length (number): The desired length of the vector.

Example

javascript const vector = new VectorUint8C(5);

Methods

set(index, value)

Sets the value at the specified index. The value is clamped between 0 and 255.

  • Parameters:
    • index (number): The index to set.
    • value (number): The value to set.

get(index)

Retrieves the value at the specified index.

  • Parameters:
    • index (number): The index to retrieve.

Example

javascript vector.set(2, 128); console.log(vector.get(2)); // Outputs: 128

🌟 Examples

Here are some examples of how to use the ndarray-vector-uint8c library in various scenarios.

Example 1: Basic Vector Operations

```javascript const { VectorUint8C } = require('ndarray-vector-uint8c');

const vector = new VectorUint8C(5); vector.set(0, 100); vector.set(1, 200); vector.set(2, 300); // This will be clamped to 255

console.log(vector.get(0)); // Outputs: 100 console.log(vector.get(1)); // Outputs: 200 console.log(vector.get(2)); // Outputs: 255 ```

Example 2: Iterating Over a Vector

You can iterate over the vector to perform operations on each element.

javascript for (let i = 0; i < vector.length; i++) { console.log(vector.get(i)); }

Example 3: Creating a Vector from an Array

You can initialize a vector with values from an existing array.

```javascript const initialValues = [50, 150, 250]; const vector = new VectorUint8C(initialValues.length);

initialValues.forEach((value, index) => { vector.set(index, value); });

console.log(vector.get(0)); // Outputs: 50 console.log(vector.get(1)); // Outputs: 150 console.log(vector.get(2)); // Outputs: 250 ```

🤝 Contributing

We welcome contributions to the ndarray-vector-uint8c project. If you have ideas for improvements or new features, feel free to fork the repository and submit a pull request.

Steps to Contribute

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Make your changes and commit them.
  4. Push your changes to your forked repository.
  5. Submit a pull request.

📄 License

This project is licensed under the MIT License. See the LICENSE file for details.

📬 Contact

For questions or feedback, you can reach out via GitHub issues or contact the maintainer directly.

For the latest releases, visit this link.


Thank you for checking out the ndarray-vector-uint8c repository! We hope you find it useful for your projects involving unsigned 8-bit integer vectors.

Owner

  • Name: Laxman Pandey
  • Login: Laxman44
  • Kind: user
  • Location: Nepal

Student, currently studying BSC Physics at Tribhuwan University.

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
  • Push event: 401
  • Create event: 2
Last Year
  • Push event: 401
  • Create event: 2

Dependencies

package.json npm
  • @stdlib/array-buffer ^0.2.2 development
  • @stdlib/array-float64 ^0.2.2 development
  • @stdlib/array-uint8c ^0.2.2 development
  • @stdlib/assert-is-equal-uint8clampedarray github:stdlib-js/assert-is-equal-uint8clampedarray#main development
  • @stdlib/assert-is-ndarray-like ^0.2.2 development
  • @stdlib/assert-is-ndarray-like-with-data-type github:stdlib-js/assert-is-ndarray-like-with-data-type#main development
  • @stdlib/bench-harness ^0.2.2 development
  • @stdlib/blas-ext-sum github:stdlib-js/blas-ext-sum#main development
  • @stdlib/buffer-from-array ^0.2.2 development
  • @stdlib/math-base-special-pow ^0.3.0 development
  • @stdlib/ndarray-base-assert-is-read-only ^0.2.2 development
  • @stdlib/ndarray-data-buffer ^0.2.2 development
  • @stdlib/ndarray-map github:stdlib-js/ndarray-map#main development
  • @stdlib/random-array-discrete-uniform ^0.2.1 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/ndarray-vector-ctor github:stdlib-js/ndarray-vector-ctor#main
  • @stdlib/types ^0.4.3