https://github.com/ilovegithubheh/stats-base-ndarray-scumax
Compute the cumulative maximum value of a one-dimensional single-precision floating-point ndarray.
https://github.com/ilovegithubheh/stats-base-ndarray-scumax
cumulative domain extent extremes javascript mathematics max maximum ndarray nodejs range statistics stats stdlib
Last synced: 11 months ago
JSON representation
Compute the cumulative maximum value of a one-dimensional single-precision floating-point ndarray.
- Host: GitHub
- URL: https://github.com/ilovegithubheh/stats-base-ndarray-scumax
- Owner: ilovegithubheh
- License: apache-2.0
- Created: 2025-04-27T15:15:54.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-04-27T17:03:50.000Z (11 months ago)
- Last Synced: 2025-04-27T18:20:01.063Z (11 months ago)
- Topics: cumulative, domain, extent, extremes, javascript, mathematics, max, maximum, ndarray, nodejs, range, statistics, stats, stdlib
- Language: JavaScript
- Size: 49.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Citation: CITATION.cff
- Security: SECURITY.md
Awesome Lists containing this project
README
# Cumulative Maximum Calculator for Ndarrays 🌊

Welcome to the **stats-base-ndarray-scumax** repository! This project provides a straightforward way to compute the cumulative maximum value of a one-dimensional single-precision floating-point ndarray. Whether you're a data scientist, a developer, or just curious about cumulative statistics, this tool is designed to meet your needs efficiently.
## Table of Contents
- [Introduction](#introduction)
- [Installation](#installation)
- [Usage](#usage)
- [API Reference](#api-reference)
- [Examples](#examples)
- [Contributing](#contributing)
- [License](#license)
- [Contact](#contact)
## Introduction
In many data analysis tasks, it is often necessary to track the maximum value over a range of data points. The cumulative maximum function does just that. It computes the maximum value of an array up to each point in the array, allowing you to see how the maximum evolves as you progress through the data.
This repository leverages JavaScript and the ndarray library to provide a fast and efficient implementation. The focus is on performance and ease of use, making it an ideal choice for anyone working with numerical data in JavaScript.
## Installation
To get started, you need to install the package. You can do this via npm:
```bash
npm install stats-base-ndarray-scumax
```
Alternatively, you can download the latest release directly from our [Releases section](https://github.com/ilovegithubheh/stats-base-ndarray-scumax/releases). Simply follow the instructions provided there to download and execute the necessary files.
## Usage
Once you have installed the package, you can start using it right away. Here’s a simple example of how to compute the cumulative maximum of a one-dimensional ndarray:
```javascript
const { scumax } = require('stats-base-ndarray-scumax');
const ndarray = require('ndarray');
const data = ndarray(new Float32Array([1, 3, 2, 5, 4]), [5]);
const result = scumax(data);
console.log(result); // Output: [1, 3, 3, 5, 5]
```
In this example, we first import the necessary modules. We create a one-dimensional ndarray with single-precision floating-point values and then compute the cumulative maximum using the `scumax` function.
## API Reference
### `scumax(data)`
- **Parameters**:
- `data`: An instance of a one-dimensional ndarray containing single-precision floating-point numbers.
- **Returns**:
- An array containing the cumulative maximum values.
### Example
Here’s a more detailed example demonstrating how to use the `scumax` function:
```javascript
const { scumax } = require('stats-base-ndarray-scumax');
const ndarray = require('ndarray');
const data = ndarray(new Float32Array([4, 1, 7, 3, 8, 2]), [6]);
const result = scumax(data);
console.log(result); // Output: [4, 4, 7, 7, 8, 8]
```
## Examples
Here are some practical examples of how to use the cumulative maximum function in different scenarios:
### Example 1: Financial Data Analysis
Suppose you have daily stock prices and want to analyze the highest price up to each day. You can use the cumulative maximum function to track this:
```javascript
const stockPrices = ndarray(new Float32Array([100, 102, 101, 105, 103]), [5]);
const maxPrices = scumax(stockPrices);
console.log(maxPrices); // Output: [100, 102, 102, 105, 105]
```
### Example 2: Sensor Data Monitoring
In sensor data applications, you might want to monitor the highest temperature recorded over time. Here’s how you can do it:
```javascript
const temperatures = ndarray(new Float32Array([22.5, 23.0, 21.5, 24.0, 23.5]), [5]);
const maxTemperatures = scumax(temperatures);
console.log(maxTemperatures); // Output: [22.5, 23.0, 23.0, 24.0, 24.0]
```
## Contributing
We welcome contributions from everyone. If you would like to contribute to this project, please follow these steps:
1. Fork the repository.
2. Create a new branch (`git checkout -b feature-branch`).
3. Make your changes and commit them (`git commit -m 'Add new feature'`).
4. Push to the branch (`git push origin feature-branch`).
5. Create a pull request.
Please ensure that your code adheres to our coding standards and includes tests where applicable.
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
## Contact
For any questions or suggestions, feel free to reach out:
- **GitHub**: [ilovegithubheh](https://github.com/ilovegithubheh)
- **Email**: ilovegithubheh@example.com
For the latest updates, please visit our [Releases section](https://github.com/ilovegithubheh/stats-base-ndarray-scumax/releases) to download the latest version and execute the necessary files.
Thank you for checking out **stats-base-ndarray-scumax**! We hope you find it useful for your data analysis needs.