Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
f554466
initial FlexVector implementation
chrissimpkins May 10, 2025
52b91d4
expand FlexVector API, make it more ergonomic
chrissimpkins May 10, 2025
18da0e1
remove unnecessary clone
chrissimpkins May 10, 2025
b73c365
add inline
chrissimpkins May 10, 2025
6ed850f
remove inline in trait signatures
chrissimpkins May 10, 2025
18a4473
add FlexVector FromIter trait support
chrissimpkins May 10, 2025
b86f807
add cross and angle_with vector operation methods
chrissimpkins May 10, 2025
46a09e7
expand trait impl, refactor trait bounds
chrissimpkins May 10, 2025
37de996
refactor min / max to minimum / maximum
chrissimpkins May 11, 2025
953b815
begin VectorOps trait tests
chrissimpkins May 11, 2025
159f8d4
refactor trait impl approach to support bounds checks on FlexVector t…
chrissimpkins May 11, 2025
9f8ea75
refactor core logic to an impl that can be used with FlexVector and V…
chrissimpkins May 12, 2025
33128f9
refactor minimum and maximum
chrissimpkins May 12, 2025
a3f7c26
new tests
chrissimpkins May 12, 2025
71268ae
refactor normalize and normalize_to to make core logic available acro…
chrissimpkins May 12, 2025
a041e20
FlexVector method support expansion and trait refactoring
chrissimpkins May 15, 2025
02fc1cb
refactor binops division macros, add flexvector initialization macro
chrissimpkins May 18, 2025
7621686
add FlexVector try_from_iter fallible init method and try_flexvector …
chrissimpkins May 18, 2025
3e3531e
remove unnecessary clone on negate method
chrissimpkins May 18, 2025
9673a91
add prelude with core traits, types, macros in scope
chrissimpkins May 18, 2025
d450fcf
add try_from_fn method on FlexVector
chrissimpkins May 18, 2025
b27ef6d
use f directly in from_fn map
chrissimpkins May 18, 2025
31ba4f3
add FlexVector try_from_fn constructor method
chrissimpkins May 18, 2025
f5516eb
add FlexVector flatten and flatten_owned methods
chrissimpkins May 18, 2025
2f83e9b
refactor flatten call approach
chrissimpkins May 18, 2025
1e8194c
refactor flatten_owned name to flatten_cloned
chrissimpkins May 18, 2025
9116f12
add FlexVector cloned method
chrissimpkins May 18, 2025
0c5dd4c
add FlexVector zip and zip_with methods
chrissimpkins May 19, 2025
bc422dc
inline new functions
chrissimpkins May 19, 2025
1892b58
add FlexVector flat_map method
chrissimpkins May 19, 2025
81cdb43
Add FlexVector step_by method
chrissimpkins May 19, 2025
1fde5a9
Add FlexVector Borrow & BorrowMut trait impl
chrissimpkins May 19, 2025
4fec35f
add FlexVector Index, IndexMut trait impl, including Range support
chrissimpkins May 19, 2025
c75a4cb
add FlexVector repeat_pattern function
chrissimpkins May 19, 2025
0c67583
add FlexVector create_mask, filter_by_mask
chrissimpkins May 19, 2025
9d79ef3
update trait bounds on VectorOps trait functions
chrissimpkins May 19, 2025
4342d1f
Add VectorOps trait elementwise_min and elementwise_max functions, im…
chrissimpkins May 19, 2025
f07fa0b
add VectorOps elementwise_clamp function, add FlexVector impl
chrissimpkins May 19, 2025
6b91abe
update project short description
chrissimpkins May 19, 2025
4a161cf
add FlexVector filter, reduce and fold methods
chrissimpkins May 19, 2025
f8e4199
update .gitignore
chrissimpkins May 22, 2025
04e65f2
extensive FlexVector refactor to add Row and Column sub-types
chrissimpkins May 22, 2025
3bd1f39
stub source documentation to quiet clippy lints
chrissimpkins May 22, 2025
88b1c92
fix clippy lint errors
chrissimpkins May 22, 2025
43db914
Add FlexVector From<Box<T>> and From<Arc<T>> impl
chrissimpkins May 22, 2025
f21b9da
Add more FlexVector collection interop trait / method support
chrissimpkins May 22, 2025
1a5a063
add LTO=true to release builds
chrissimpkins May 26, 2025
794dfb0
add VectorSlice and VectorSliceMut types
chrissimpkins May 26, 2025
da3606e
refactor "components" struct fields to "elements"
chrissimpkins May 26, 2025
ed7582c
fix clippy lint into_iter => iter_mut
chrissimpkins May 26, 2025
41dda94
Add Debug and Display impl for VectorSlice and VectorSliceMut
chrissimpkins May 26, 2025
faa10d3
Add Hash, Ord, PartialOrd trait impl on VectorSlice type
chrissimpkins May 26, 2025
fcdec59
refactor VectorBase and VectorOps* traits to immutable and mutable tr…
chrissimpkins May 26, 2025
eb7a7f4
fix the Hermitian dot product utility impl
chrissimpkins May 27, 2025
eabfdd2
complete unit tests on the FlexVector type
chrissimpkins May 27, 2025
35eaf84
Add VectorBase impl for VectorSlice, VectorBase + VectorBaseMut for V…
chrissimpkins May 27, 2025
251242a
refactor scale and negate VectorOps method impl to the trait definition
chrissimpkins May 28, 2025
db83452
Add VectorOps impl for VectorSlice, VectorOps + VectorOpsMut impl for…
chrissimpkins May 28, 2025
a137076
improve performance of mut_translate_impl
chrissimpkins May 28, 2025
69d8f18
Add VectorOps preallocated buffer functions: translate_into, cross_in…
chrissimpkins May 28, 2025
cac27be
update trait bounds on normalize and lerp
chrissimpkins May 29, 2025
863d3fb
impl VectorOpsFloat on VectorSlice and VectorSliceMut
chrissimpkins May 29, 2025
83cd33e
impl VectorOpsFloatMut on VectorSliceMut
chrissimpkins May 29, 2025
26587cd
Impl VectorOpsComplex for VectorSlice and VectorSliceMut
chrissimpkins May 29, 2025
2013397
add VectorOpsFloat normalize_into, normalize_to_into, lerp_into metho…
chrissimpkins May 30, 2025
402deb8
refactor numeric type only operations to a Copy bound
chrissimpkins May 30, 2025
762641b
Add VectorOpsFloat midpoint_into, project_onto_into methods, VectorSl…
chrissimpkins May 30, 2025
a4032ab
Add VectorOpsComplex normalize_into, normalize_to_into, add FlexVecto…
chrissimpkins May 31, 2025
9dadd10
refactor number type casts implementation
chrissimpkins May 31, 2025
3931075
Add VectorOpsComplex lerp_into, midpoint_into; add FlexVector, Vector…
chrissimpkins May 31, 2025
e1088d4
add VectorOpsComplex project_onto_into; add FlexVector, VectorSlice, …
chrissimpkins May 31, 2025
da39696
minor refactor of utility function trait bounds
chrissimpkins May 31, 2025
730ec5d
impl VectorSlice and VectorSliceMut is_row, is_column, to_flexvector …
chrissimpkins May 31, 2025
1171564
Add VectorHasOrientation trait impl for VectorSlice and VectorSliceMut
chrissimpkins May 31, 2025
9baf79d
refactor VectorHasOrientation to include the orientation_name method
chrissimpkins Jun 4, 2025
a266c31
add FlexVector scalar Add, AddAssign, Sub, SubAssign operator overloa…
chrissimpkins Jun 4, 2025
602940d
Add FlexVector broadcast_to method to support broadcasting
chrissimpkins Jun 4, 2025
77f473d
add From VectorSlice and VectorSliceMut impl on FlexVector
chrissimpkins Jun 4, 2025
2687c98
Add From trait impl on VectorSlice, add PartialEq, Eq, Ord, PartialOr…
chrissimpkins Jun 5, 2025
47af72d
Add short type aliases for column and row VectorSlice and VectorSlice…
chrissimpkins Jun 7, 2025
aa983f2
remove FVector public type alias
chrissimpkins Jun 7, 2025
13ffea2
refactor public type alias names for FlexVector, VectorSlice, VectorS…
chrissimpkins Jun 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/target/
Cargo.lock
**/*.rs.bk
examples
.DS_Store

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ license = "Apache-2.0"
edition = "2021"
keywords = ["vector", "math", "real", "imaginary", "complex"]
repository = "https://github.com/chrissimpkins/vectora"
description = "A vector computation library"
description = "Fast, Flexible n-Dimensional Vector Math for Rust"
readme = "README.md"

exclude = [
Expand Down Expand Up @@ -34,3 +34,6 @@ harness = false
[package.metadata.docs.rs]
# Whether to pass `--all-features` to Cargo (default: false)
all-features = true

[profile.release]
lto = true
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<img src="https://raw.githubusercontent.com/chrissimpkins/vectora/img/img/vectora.png" width="350">

## A Rust library for vector computation
## Fast, Flexible n-Dimensional Vector Math for Rust

[![Crates.io](https://img.shields.io/crates/v/vectora)](https://crates.io/crates/vectora)
[![docs.rs](https://img.shields.io/docsrs/vectora)](https://docs.rs/vectora)
Expand All @@ -15,7 +15,7 @@

## About

Vectora is a library for n-dimensional vector computation with real and complex scalar types. The main library entry point is the [`Vector`](https://docs.rs/vectora/latest/vectora/types/vector/struct.Vector.html) struct. Please see the [Gettting Started Guide](https://docs.rs/vectora/latest/vectora/#getting-started) for a detailed library API overview with examples.
Vectora is a library for n-dimensional vector math with real and complex scalar types. The main library entry point is the [`Vector`](https://docs.rs/vectora/latest/vectora/types/vector/struct.Vector.html) struct. Please see the [Gettting Started Guide](https://docs.rs/vectora/latest/vectora/#getting-started) for a detailed library API overview with examples.

## User documentation

Expand Down
21 changes: 18 additions & 3 deletions src/errors.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
//! Error types.

/// Errors that occur while working with [`crate::types::vector::Vector`]
/// Errors that occur while working with vector types.
#[derive(Debug)]
pub enum VectorError {
/// Occurs when an operation that requires data in a [`crate::types::vector::Vector`] is
/// requested with an empty [`crate::types::vector::Vector`]
/// Occurs when an operation that requires data in a vector type is
/// requested with an empty vector type.
EmptyVectorError(String),
/// Occurs when two vectors need to be the same length to complete an operation, and are not.
MismatchedLengthError(String),
/// Occurs when a value extends outside of a mandatory range.
OutOfRangeError(String),
/// Occurs when there is invalid data during an attempt to convert
/// from [`slice`] data.
TryFromSliceError(String),
Expand All @@ -14,6 +18,8 @@ pub enum VectorError {
TryFromVecError(String),
/// ValueError occurs when an invalid value is used in an operation
ValueError(String),
/// Errors with invalid zero vectors
ZeroVectorError(String),
}

impl std::fmt::Display for VectorError {
Expand All @@ -22,6 +28,12 @@ impl std::fmt::Display for VectorError {
VectorError::EmptyVectorError(s) => {
write!(f, "VectorError::EmptyVectorError: {s}")
}
VectorError::MismatchedLengthError(s) => {
write!(f, "VectorError::MismatchedLengthError: {s}")
}
VectorError::OutOfRangeError(s) => {
write!(f, "VectorError::OutOfRangeError: {s}")
}
VectorError::TryFromVecError(s) => {
write!(f, "VectorError::TryFromVecError: {s}")
}
Expand All @@ -31,6 +43,9 @@ impl std::fmt::Display for VectorError {
VectorError::ValueError(s) => {
write!(f, "VectorError::ValueError: {s}")
}
VectorError::ZeroVectorError(s) => {
write!(f, "VectorError::ZeroVectorError: {s}")
}
}
}
}
23 changes: 23 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,29 @@
#![cfg_attr(docsrs, feature(doc_cfg))]

pub mod errors;
pub mod macros;
pub mod types;

pub use types::flexvector::FlexVector;
pub use types::vector::Vector;

/// The vectora prelude: import this module to bring all core traits, types, and macros into scope.
///
/// This prelude includes:
/// - Core traits
/// - Main types
/// - Main macros
pub mod prelude {
// Traits
pub use crate::types::traits::{
Transposable, VectorBase, VectorBaseMut, VectorHasOrientation, VectorOps, VectorOpsComplex,
VectorOpsComplexMut, VectorOpsFloat, VectorOpsFloatMut, VectorOpsMut,
};
// Types
pub use crate::types::flexvector::FlexVector;
pub use crate::types::orientation::{Column, Row, VectorOrientation};
pub use crate::types::vector::Vector;
pub use crate::types::vectorslice::{VectorSlice, VectorSliceMut};
// Macros
pub use crate::{fv, fv_from, fv_iter, try_fv_iter, try_vector, vector};
}
Loading
Loading