pub trait Computation {
type Dim;
type Item;
Show 36 methods
// Provided methods
fn add<Rhs>(self, rhs: Rhs) -> Add<Self, Rhs>
where Self: Sized,
Add<Self, Rhs>: Computation { ... }
fn sub<Rhs>(self, rhs: Rhs) -> Sub<Self, Rhs>
where Self: Sized,
Sub<Self, Rhs>: Computation { ... }
fn mul<Rhs>(self, rhs: Rhs) -> Mul<Self, Rhs>
where Self: Sized,
Mul<Self, Rhs>: Computation { ... }
fn div<Rhs>(self, rhs: Rhs) -> Div<Self, Rhs>
where Self: Sized,
Div<Self, Rhs>: Computation { ... }
fn pow<Rhs>(self, rhs: Rhs) -> Pow<Self, Rhs>
where Self: Sized,
Pow<Self, Rhs>: Computation { ... }
fn neg(self) -> Neg<Self>
where Self: Sized,
Neg<Self>: Computation { ... }
fn abs(self) -> Abs<Self>
where Self: Sized,
Abs<Self>: Computation { ... }
fn sin(self) -> Sin<Self>
where Self: Sized,
Sin<Self>: Computation { ... }
fn cos(self) -> Cos<Self>
where Self: Sized,
Cos<Self>: Computation { ... }
fn tan(self) -> Tan<Self>
where Self: Sized,
Tan<Self>: Computation { ... }
fn asin(self) -> Asin<Self>
where Self: Sized,
Asin<Self>: Computation { ... }
fn acos(self) -> Acos<Self>
where Self: Sized,
Acos<Self>: Computation { ... }
fn atan(self) -> Atan<Self>
where Self: Sized,
Atan<Self>: Computation { ... }
fn eq<Rhs>(self, rhs: Rhs) -> Eq<Self, Rhs>
where Self: Sized,
Eq<Self, Rhs>: Computation { ... }
fn ne<Rhs>(self, rhs: Rhs) -> Ne<Self, Rhs>
where Self: Sized,
Ne<Self, Rhs>: Computation { ... }
fn lt<Rhs>(self, rhs: Rhs) -> Lt<Self, Rhs>
where Self: Sized,
Lt<Self, Rhs>: Computation { ... }
fn le<Rhs>(self, rhs: Rhs) -> Le<Self, Rhs>
where Self: Sized,
Le<Self, Rhs>: Computation { ... }
fn gt<Rhs>(self, rhs: Rhs) -> Gt<Self, Rhs>
where Self: Sized,
Gt<Self, Rhs>: Computation { ... }
fn ge<Rhs>(self, rhs: Rhs) -> Ge<Self, Rhs>
where Self: Sized,
Ge<Self, Rhs>: Computation { ... }
fn max(self) -> Max<Self>
where Self: Sized,
Max<Self>: Computation { ... }
fn not(self) -> Not<Self>
where Self: Sized,
Not<Self>: Computation { ... }
fn enumerate<F>(self, f: Function<(Name, Name), F>) -> Enumerate<Self, F>
where Self: Sized,
Enumerate<Self, F>: Computation { ... }
fn sum(self) -> Sum<Self>
where Self: Sized,
Sum<Self>: Computation { ... }
fn zip<Rhs>(self, rhs: Rhs) -> Zip<Self, Rhs>
where Self: Sized,
Zip<Self, Rhs>: Computation { ... }
fn fst(self) -> Fst<Self>
where Self: Sized,
Fst<Self>: Computation { ... }
fn snd(self) -> Snd<Self>
where Self: Sized,
Snd<Self>: Computation { ... }
fn black_box<F, FDim, FItem>(self, f: F) -> BlackBox<Self, F, FDim, FItem>
where Self: Sized,
BlackBox<Self, F, FDim, FItem>: Computation { ... }
fn if_<ArgNames, P, FTrue, FFalse>(
self,
arg_names: ArgNames,
predicate: P,
f_true: FTrue,
f_false: FFalse,
) -> If<Self, ArgNames, P, FTrue, FFalse>
where Self: Sized,
If<Self, ArgNames, P, FTrue, FFalse>: Computation { ... }
fn loop_while<ArgNames, F, P>(
self,
arg_names: ArgNames,
f: F,
predicate: P,
) -> LoopWhile<Self, ArgNames, F, P>
where Self: Sized,
LoopWhile<Self, ArgNames, F, P>: Computation { ... }
fn then<ArgNames, F>(
self,
f: Function<ArgNames, F>,
) -> Then<Self, ArgNames, F>
where Self: Sized,
Then<Self, ArgNames, F>: Computation { ... }
fn identity_matrix<T>(self) -> IdentityMatrix<Self, T>
where Self: Sized,
IdentityMatrix<Self, T>: Computation { ... }
fn scalar_product<Rhs>(self, rhs: Rhs) -> ScalarProduct<Self, Rhs>
where Self: Sized,
Mul<Self, Rhs>: Computation,
ScalarProduct<Self, Rhs>: Computation { ... }
fn mat_mul<Rhs>(self, rhs: Rhs) -> MatMul<Self, Rhs>
where Self: Sized,
MatMul<Self, Rhs>: Computation { ... }
fn mul_out<Rhs>(self, rhs: Rhs) -> MulOut<Self, Rhs>
where Self: Sized,
MulOut<Self, Rhs>: Computation { ... }
fn mul_col<Rhs>(self, rhs: Rhs) -> MulCol<Self, Rhs>
where Self: Sized,
MulCol<Self, Rhs>: Computation { ... }
fn len(self) -> Len<Self>
where Self: Sized,
Len<Self>: Computation { ... }
}
Expand description
A type representing a computation.
This trait does little on its own.
Additional traits,
such as Run
,
must be implemented
to use a computation.
Required Associated Types§
Provided Methods§
fn add<Rhs>(self, rhs: Rhs) -> Add<Self, Rhs>
fn sub<Rhs>(self, rhs: Rhs) -> Sub<Self, Rhs>
fn mul<Rhs>(self, rhs: Rhs) -> Mul<Self, Rhs>
fn div<Rhs>(self, rhs: Rhs) -> Div<Self, Rhs>
fn pow<Rhs>(self, rhs: Rhs) -> Pow<Self, Rhs>
fn neg(self) -> Neg<Self>
fn abs(self) -> Abs<Self>
fn sin(self) -> Sin<Self>
fn cos(self) -> Cos<Self>
fn tan(self) -> Tan<Self>
fn asin(self) -> Asin<Self>
fn acos(self) -> Acos<Self>
fn atan(self) -> Atan<Self>
fn eq<Rhs>(self, rhs: Rhs) -> Eq<Self, Rhs>
fn ne<Rhs>(self, rhs: Rhs) -> Ne<Self, Rhs>
fn lt<Rhs>(self, rhs: Rhs) -> Lt<Self, Rhs>
fn le<Rhs>(self, rhs: Rhs) -> Le<Self, Rhs>
fn gt<Rhs>(self, rhs: Rhs) -> Gt<Self, Rhs>
fn ge<Rhs>(self, rhs: Rhs) -> Ge<Self, Rhs>
fn max(self) -> Max<Self>
fn not(self) -> Not<Self>
fn enumerate<F>(self, f: Function<(Name, Name), F>) -> Enumerate<Self, F>
fn sum(self) -> Sum<Self>
fn zip<Rhs>(self, rhs: Rhs) -> Zip<Self, Rhs>
fn fst(self) -> Fst<Self>
fn snd(self) -> Snd<Self>
Sourcefn black_box<F, FDim, FItem>(self, f: F) -> BlackBox<Self, F, FDim, FItem>
fn black_box<F, FDim, FItem>(self, f: F) -> BlackBox<Self, F, FDim, FItem>
Run the given regular function F
.
This acts as an escape-hatch to allow regular Rust-code in a computation, but the computation may lose features or efficiency if it is used.
fn if_<ArgNames, P, FTrue, FFalse>( self, arg_names: ArgNames, predicate: P, f_true: FTrue, f_false: FFalse, ) -> If<Self, ArgNames, P, FTrue, FFalse>
fn loop_while<ArgNames, F, P>( self, arg_names: ArgNames, f: F, predicate: P, ) -> LoopWhile<Self, ArgNames, F, P>
fn then<ArgNames, F>(self, f: Function<ArgNames, F>) -> Then<Self, ArgNames, F>
Sourcefn identity_matrix<T>(self) -> IdentityMatrix<Self, T>
fn identity_matrix<T>(self) -> IdentityMatrix<Self, T>
Return a self
by self
identity-matrix.
Diagonal elements have a value of 1
,
and non-diagonal elements have a value of 0
.
The type of elements,
T
,
may need to be specified.
Sourcefn scalar_product<Rhs>(self, rhs: Rhs) -> ScalarProduct<Self, Rhs>
fn scalar_product<Rhs>(self, rhs: Rhs) -> ScalarProduct<Self, Rhs>
Multiply and sum the elements of two vectors.
This is sometimes known as the “inner product” or “dot product”.
Sourcefn mul_out<Rhs>(self, rhs: Rhs) -> MulOut<Self, Rhs>
fn mul_out<Rhs>(self, rhs: Rhs) -> MulOut<Self, Rhs>
Multiply elements from the Cartesian product of two vectors.
This is sometimes known as “outer product”, and it is equivalent to matrix-multiplying a column-matrix by a row-matrix.
Sourcefn mul_col<Rhs>(self, rhs: Rhs) -> MulCol<Self, Rhs>
fn mul_col<Rhs>(self, rhs: Rhs) -> MulCol<Self, Rhs>
Matrix-multiply a matrix by a column-matrix, returning a vector.