Struct rgsl::types::vector::VectorF32 [] [src]

pub struct VectorF32 {
    // some fields omitted
}

Methods

impl VectorF32
[src]

fn new(size: usize) -> Option<VectorF32>

create a new VectorF32 with all elements set to zero

fn from_slice(slice: &[f32]) -> Option<VectorF32>

fn len(&self) -> usize

fn get(&self, i: usize) -> f32

This function returns the i-th element of a vector v. If i lies outside the allowed range of 0 to n-1 then the error handler is invoked and 0 is returned.

fn set(&self, i: usize, x: f32) -> &VectorF32

This function sets the value of the i-th element of a vector v to x. If i lies outside the allowed range of 0 to n-1 then the error handler is invoked.

fn set_all(&self, x: f32) -> &VectorF32

This function sets all the elements of the vector v to the value x.

fn set_zero(&self) -> &VectorF32

This function sets all the elements of the vector v to zero.

fn set_basis(&self, i: usize) -> &VectorF32

This function makes a basis vector by setting all the elements of the vector v to zero except for the i-th element which is set to one.

fn copy_from(&self, other: &VectorF32) -> Value

This function copies the elements of the other vector into the self vector. The two vectors must have the same length.

fn copy_to(&self, other: &VectorF32) -> Value

This function copies the elements of the self vector into the other vector. The two vectors must have the same length.

fn swap(&self, other: &VectorF32) -> Value

This function exchanges the elements of the vectors by copying. The two vectors must have the same length.

fn swap_elements(&self, i: usize, j: usize) -> Value

This function exchanges the i-th and j-th elements of the vector v in-place.

fn reverse(&self) -> Value

This function reverses the order of the elements of the vector v.

fn add(&self, other: &VectorF32) -> Value

This function adds the elements of the other vector to the elements of the self vector. The result a_i <- a_i + b_i is stored in self and other remains unchanged. The two vectors must have the same length.

fn sub(&self, other: &VectorF32) -> Value

This function subtracts the elements of the self vector from the elements of the other vector. The result a_i <- a_i - b_i is stored in self and other remains unchanged. The two vectors must have the same length.

fn mul(&self, other: &VectorF32) -> Value

This function multiplies the elements of the self vector a by the elements of the other vector. The result a_i <- a_i * b_i is stored in self and other remains unchanged. The two vectors must have the same length.

fn div(&self, other: &VectorF32) -> Value

This function divides the elements of the self vector by the elements of the other vector. The result a_i <- a_i / b_i is stored in self and other remains unchanged. The two vectors must have the same length.

fn scale(&self, x: f32) -> Value

This function multiplies the elements of the self vector by the constant factor x. The result a_i <- a_i is stored in self.

fn add_constant(&self, x: f32) -> Value

This function adds the constant value x to the elements of the self vector. The result a_i <- a_i + x is stored in self.

fn max(&self) -> f32

This function returns the maximum value in the self vector.

fn min(&self) -> f32

This function returns the minimum value in the self vector.

fn minmax(&self, min_out: &mut f32, max_out: &mut f32)

This function returns the minimum and maximum values in the self vector, storing them in min_out and max_out.

fn max_index(&self) -> usize

This function returns the index of the maximum value in the self vector. When there are several equal maximum elements then the lowest index is returned.

fn min_index(&self) -> usize

This function returns the index of the minimum value in the self vector. When there are several equal minimum elements then the lowest index is returned.

fn minmax_index(&self) -> (usize, usize)

This function returns the indices of the minimum and maximum values in the self vector, storing them in imin and imax. When there are several equal minimum or maximum elements then the lowest indices are returned.

fn is_null(&self) -> bool

This function returns true if all the elements of the self vector are equal to 0.

fn is_pos(&self) -> bool

This function returns true if all the elements of the self vector are stricly positive.

fn is_neg(&self) -> bool

This function returns true if all the elements of the self vector are stricly negative.

fn is_non_neg(&self) -> bool

This function returns true if all the elements of the self vector are stricly non-negative.

fn equal(&self, other: &VectorF32) -> bool

fn clone(&self) -> Option<VectorF32>

Trait Implementations

impl Drop for VectorF32
[src]

fn drop(&mut self)

A method called when the value goes out of scope. Read more

impl Debug for VectorF32
[src]

fn fmt(&self, f: &mut Formatter) -> Result

Formats the value using the given formatter.