2013-05-14 19:35:01 +08:00
|
|
|
pub trait Dot<T>
|
|
|
|
{
|
2013-05-17 05:59:41 +08:00
|
|
|
/// Computes the dot (inner) product of two objects.
|
2013-05-14 19:35:01 +08:00
|
|
|
fn dot(&self, &Self) -> T;
|
2013-05-17 05:59:41 +08:00
|
|
|
/// Computes the norm a an object.
|
2013-05-14 19:35:01 +08:00
|
|
|
fn norm(&self) -> T;
|
2013-05-17 05:59:41 +08:00
|
|
|
/**
|
|
|
|
* Computes the squared norm of an object.
|
|
|
|
*
|
|
|
|
* Computes the squared norm of an object. Computation of the squared norm
|
|
|
|
* is usually faster than the norm itself.
|
|
|
|
*/
|
2013-05-14 19:35:01 +08:00
|
|
|
fn sqnorm(&self) -> T; // { self.dot(self); }
|
|
|
|
}
|