Struct rgsl::types::vector_complex::VectorComplexF64
source · pub struct VectorComplexF64 { /* private fields */ }
Implementations§
source§impl VectorComplexF64
impl VectorComplexF64
sourcepub fn new(size: usize) -> Option<VectorComplexF64>
pub fn new(size: usize) -> Option<VectorComplexF64>
create a new VectorComplexF64 with all elements set to zero
pub fn from_slice(slice: &[ComplexF64]) -> Option<VectorComplexF64>
pub fn len(&self) -> usize
sourcepub fn get(&self, i: usize) -> ComplexF64
pub fn get(&self, i: usize) -> ComplexF64
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.
sourcepub fn set(&mut self, i: usize, x: &ComplexF64) -> &VectorComplexF64
pub fn set(&mut self, i: usize, x: &ComplexF64) -> &VectorComplexF64
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.
sourcepub fn set_all(&mut self, x: &ComplexF64) -> &VectorComplexF64
pub fn set_all(&mut self, x: &ComplexF64) -> &VectorComplexF64
This function sets all the elements of the vector v to the value x.
sourcepub fn set_zero(&mut self) -> &VectorComplexF64
pub fn set_zero(&mut self) -> &VectorComplexF64
This function sets all the elements of the vector v to zero.
sourcepub fn set_basis(&mut self, i: usize) -> &VectorComplexF64
pub fn set_basis(&mut self, i: usize) -> &VectorComplexF64
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.
sourcepub fn copy_from(&mut self, other: &VectorComplexF64) -> Value
pub fn copy_from(&mut self, other: &VectorComplexF64) -> Value
This function copies the elements of the other vector into the self vector. The two vectors must have the same length.
sourcepub fn copy_to(&self, other: &mut VectorComplexF64) -> Value
pub fn copy_to(&self, other: &mut VectorComplexF64) -> Value
This function copies the elements of the self vector into the other vector. The two vectors must have the same length.
sourcepub fn swap(&mut self, other: &mut VectorComplexF64) -> Value
pub fn swap(&mut self, other: &mut VectorComplexF64) -> Value
This function exchanges the elements of the vectors by copying. The two vectors must have the same length.
sourcepub fn swap_elements(&mut self, i: usize, j: usize) -> Value
pub fn swap_elements(&mut self, i: usize, j: usize) -> Value
This function exchanges the i-th and j-th elements of the vector v in-place.
sourcepub fn reverse(&mut self) -> Value
pub fn reverse(&mut self) -> Value
This function reverses the order of the elements of the vector v.
sourcepub fn add(&mut self, other: &VectorComplexF64) -> Value
pub fn add(&mut self, other: &VectorComplexF64) -> 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.
sourcepub fn sub(&mut self, other: &VectorComplexF64) -> Value
pub fn sub(&mut self, other: &VectorComplexF64) -> 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.
sourcepub fn mul(&mut self, other: &VectorComplexF64) -> Value
pub fn mul(&mut self, other: &VectorComplexF64) -> 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.
sourcepub fn div(&mut self, other: &VectorComplexF64) -> Value
pub fn div(&mut self, other: &VectorComplexF64) -> 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.
sourcepub fn scale(&mut self, x: &ComplexF64) -> Value
pub fn scale(&mut self, x: &ComplexF64) -> 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.
sourcepub fn add_constant(&mut self, x: &ComplexF64) -> Value
pub fn add_constant(&mut self, x: &ComplexF64) -> 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.
sourcepub fn is_null(&self) -> bool
pub fn is_null(&self) -> bool
This function returns true if all the elements of the self vector are equal to 0.
sourcepub fn is_pos(&self) -> bool
pub fn is_pos(&self) -> bool
This function returns true if all the elements of the self vector are stricly positive.
sourcepub fn is_neg(&self) -> bool
pub fn is_neg(&self) -> bool
This function returns true if all the elements of the self vector are stricly negative.
sourcepub fn is_non_neg(&self) -> bool
pub fn is_non_neg(&self) -> bool
This function returns true if all the elements of the self vector are stricly non-negative.