An open API service indexing awesome lists of open source software.

https://github.com/g1eng/matrixa

List manipulation library with two-dimensional, dynamic-sized payload.
https://github.com/g1eng/matrixa

linear-algebra numerical rust string-manipulation string-matching

Last synced: about 1 year ago
JSON representation

List manipulation library with two-dimensional, dynamic-sized payload.

Awesome Lists containing this project

README

          

# About

[![codecov](https://codecov.io/gh/g1eng/matrixa/branch/master/graph/badge.svg?token=PSSEN7S1FH)](https://codecov.io/gh/g1eng/matrixa)

matrixa.rs is an experimental library for linear algebra and list manipulation on Rust.

It supports mathematical and string manipulation for data, within the type of `Matrix` which holds the payload in vector-in-vector with dynamic length of row and column.
You can declare and manipulate two-dimensional matrices as an object like this:

```rust
use matrixa::core::Matrix;
use matrixa::mat;

// i32
let mut im = Matrix::::new();
im.push(vec![1,2,3,4,5]).unwrap().push(vec![5,6,7,8,9]).unwrap();
im.add(1).print();
im.mul(3).print();

// f32
let fm1 = mat![
f32:
[1.0,2.0,3.0],
[2.0,3.0,4.0]
];
let fm2 = mat![
f32:
[1.1,2.2,3.3],
[2.2,3.3,4.4]
];
let fm = fm1 + fm2;
fm.print()
```

# Concepts

This is a dog food that probably tastes bad for you.

The project aims to be:

* easy-to-use and easy-to-understand its usage and behavior
* well-documented and maintainable for us, rustacenes.
* human-friendly, with syntax sugars like +, - operators or `mat![T]`.

# Features

* You can create Matrix instance for matrix declaration and its manipulation.
* `Matrix::::new()` or easy-to-use `!mat[T]` macro for the constructor.
* A matrix instance can be typed with integer such as i32, floating point such as f32, bool, reference to sized string literal (&str) or String.
* Builtin integrity checker and push or merge mechanism for panic-less append of rows or columns
* It implements Clone. You can assign a matrix to another using `=` operator or generate clone instance with `clone()`.
* It implements Iterator. You can iterate data with a representation, such as `for d in matrix`
* Almost all manipulation below results a new instance which can be mutable to the next operation.

## Core functionalities

### Core manipulator or formatters:

* new
* clone
* row_replace
* col_replace
* transpose
* fill_zero (for number matrices)
* resize

### Matchers
- equal `=`
- not equal `!=`

## Mathematical operations

### Numerical operations

| category | operator | scalar | matrix |
| --- | --- | --- | --- |
| addition | + | O* | O |
| subtraction | - | O* | O |
| product | * | O* | O |
| hadamard product | | | O* |
| division | / | O* | O |
| rem | % | O* | O |

* O: supported
* O*: supported via method

### Supported bool operations

| category | operator | description |
| --- | --- | --- |
| bit and | & | logical product of two matrices |
| bit or | \| | logical sum of two matrices |
| bit xor | ^ | exclusive disjunction |
| not | ! | negation |

### Matrix calculation
- inverse matrix
- identity matrix
- adjugate matrix
- determinant
- regular matrix detection
- trace

## String manipulation

WIP