Vector Math Library
This library provides a NumVector struct in Rust, enabling basic vector arithmetic operations. The library is designed to work with generic types that implement the required arithmetic traits.
Features
- Vector Initialization: Easily create vectors with
Vector::new(vec)or initialize an empty vector withVector::empty(). - Element-wise Arithmetic: Perform addition or subtraction on vectors element-wise.
- Scalar Operations: Multiply or divide all elements of a vector by a scalar value.
- In-Place Modifications: Supports modifying vectors directly using operators like
+=,-=,*=, and/=. - Dereferencing: Allows direct access to the underlying vector using dereferencing.
Usage
To use this library in your Rust project, add the following line to your Cargo.toml file:
[]
= "0.1.0"
Then, in your Rust code, import the library and start using the vector math operations:
use NumVector;
Future Improvements
- Allocate memory on the stack instead of the heap for vectors of small sizes.
- Write a Display implementation for the Vector struct to enable printing vectors.
Contributing
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository.
License
This library is licensed under the MIT License.