Skip to main content

Outer

Trait Outer 

Source
pub trait Outer {
    type Tensor;

    // Required method
    fn outer(&self, other: &Self) -> Self::Tensor;
}
Expand description

The vector outer product.

Required Associated Types§

Source

type Tensor

Result type.

Required Methods§

Source

fn outer(&self, other: &Self) -> Self::Tensor

Compute the outer product of two vectors.

a \otimes b = \begin{bmatrix} a_0
 \\ a_1
 \\ \vdots
 \\ a_{n}
\end{bmatrix}
\begin{bmatrix}
b_0 & b_1 & \dots & b_{n}
\end{bmatrix}
=
\begin{bmatrix}
a_0 b_0 & a_0 b_1 & \dots & a_0 b_n \\
a_1 b_0 & a_1 b_1 & \dots & a_1 b_n \\
\vdots & \vdots & \ddots & \vdots \\
a_n b_0 & a_n b_1 & \dots & a_n b_n
\end{bmatrix}
§Example
use hoomd_linear_algebra::matrix::Matrix;
use hoomd_vector::{Cartesian, Outer};

let a = Cartesian::from([2.0, 1.0]);
let b = Cartesian::from([4.0, 3.0]);

let m = Matrix {
    rows: [[8.0, 6.0], [4.0, 3.0]],
};
assert_eq!(a.outer(&b), m);

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<const N: usize> Outer for Cartesian<N>

Source§

type Tensor = Matrix<N, N>