pub struct Function { /* private fields */ }Available on crate feature
arithmetic-parser only.Expand description
Parsed complex-valued function of a single variable.
A Function instance can be created using FromStr trait. A function must use z
as the (only) argument. A function may use arithmetic operations (+, -, *, /, ^)
and/or predefined unary functions:
- General functions:
arg,sqrt,exp,log - Hyperbolic trigonometry:
sinh,cosh,tanh - Inverse hyperbolic trigonometry:
asinh,acosh,atanh
A function may define local variable assignment(s). The assignment syntax is similar to Python
(or Rust, just without the let keyword): variable name followed by = and then by
the arithmetic expression. Assignments must be separated by semicolons ;. As in Rust,
the last expression in function body is its return value.
§Examples
let function: Function = "z * z - 0.5".parse()?;
let fn_with_calls: Function = "0.8 * z + z / atanh(z ^ -4)".parse()?;
let fn_with_vars: Function = "c = -0.5 + 0.4i; z * z + c".parse()?;Trait Implementations§
Source§impl Backend<&Function> for Cpu
Available on crate features dyn_cpu_backend and cpu_backend only.
impl Backend<&Function> for Cpu
Available on crate features
dyn_cpu_backend and cpu_backend only.Source§impl ComputePoint for Function
Available on crate features dyn_cpu_backend and cpu_backend only.
impl ComputePoint for Function
Available on crate features
dyn_cpu_backend and cpu_backend only.Source§fn compute_point(&self, z: Complex32) -> Complex32
fn compute_point(&self, z: Complex32) -> Complex32
Computes the function value at the specified point.
Auto Trait Implementations§
impl Freeze for Function
impl RefUnwindSafe for Function
impl Send for Function
impl Sync for Function
impl Unpin for Function
impl UnwindSafe for Function
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more