pub struct VectorField<const P: usize, const Q: usize, const R: usize> { /* private fields */ }Expand description
A vector field F: ℝⁿ → Cl(p,q,r)_1 (grade-1 multivectors)
Represents a function that maps points in n-dimensional space to vectors (grade-1 multivectors).
§Examples
use amari_calculus::{VectorField, vector_from_slice};
// Define F(x, y, z) = (x, y, z) - radial vector field
let f = VectorField::<3, 0, 0>::new(|coords| {
vector_from_slice(&[coords[0], coords[1], coords[2]])
});
// Evaluate at (1, 2, 3)
let value = f.evaluate(&[1.0, 2.0, 3.0]);Implementations§
Source§impl<const P: usize, const Q: usize, const R: usize> VectorField<P, Q, R>
impl<const P: usize, const Q: usize, const R: usize> VectorField<P, Q, R>
Sourcepub fn new(function: fn(&[f64]) -> Multivector<P, Q, R>) -> Self
pub fn new(function: fn(&[f64]) -> Multivector<P, Q, R>) -> Self
Create a new vector field from a function
§Arguments
function- Function mapping coordinates to vectors
§Examples
use amari_calculus::{VectorField, vector_from_slice};
// Rotation field F(x, y) = (-y, x, 0)
let f = VectorField::<3, 0, 0>::new(|coords| {
vector_from_slice(&[-coords[1], coords[0], 0.0])
});Sourcepub fn with_dimension(
function: fn(&[f64]) -> Multivector<P, Q, R>,
dim: usize,
) -> Self
pub fn with_dimension( function: fn(&[f64]) -> Multivector<P, Q, R>, dim: usize, ) -> Self
Create a vector field with explicit dimension
Sourcepub fn evaluate(&self, coords: &[f64]) -> Multivector<P, Q, R>
pub fn evaluate(&self, coords: &[f64]) -> Multivector<P, Q, R>
Sourcepub fn partial_derivative(
&self,
coords: &[f64],
axis: usize,
h: f64,
) -> CalculusResult<Multivector<P, Q, R>>
pub fn partial_derivative( &self, coords: &[f64], axis: usize, h: f64, ) -> CalculusResult<Multivector<P, Q, R>>
Compute numerical derivative of vector field component along coordinate axis
§Arguments
coords- Point at which to compute derivativeaxis- Coordinate axis indexh- Step size (default: 1e-5)
Trait Implementations§
Auto Trait Implementations§
impl<const P: usize, const Q: usize, const R: usize> Freeze for VectorField<P, Q, R>
impl<const P: usize, const Q: usize, const R: usize> RefUnwindSafe for VectorField<P, Q, R>
impl<const P: usize, const Q: usize, const R: usize> Send for VectorField<P, Q, R>
impl<const P: usize, const Q: usize, const R: usize> Sync for VectorField<P, Q, R>
impl<const P: usize, const Q: usize, const R: usize> Unpin for VectorField<P, Q, R>
impl<const P: usize, const Q: usize, const R: usize> UnwindSafe for VectorField<P, Q, R>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more