Struct peroxide::complex::matrix::ComplexMatrix

source ·
pub struct ComplexMatrix {
    pub data: Vec<C64>,
    pub row: usize,
    pub col: usize,
    pub shape: Shape,
}
Expand description

R-like complex matrix structure

§Examples

use peroxide::fuga::*;
use peroxide::complex::matrix::ComplexMatrix;

let v1 = ComplexMatrix {
data: vec![
    C64::new(1f64, 1f64),
    C64::new(2f64, 2f64),
    C64::new(3f64, 3f64),
    C64::new(4f64, 4f64),
],
row: 2,
col: 2,
shape: Row,
}; // [[1+1i,2+2i],[3+3i,4+4i]]

Fields§

§data: Vec<C64>§row: usize§col: usize§shape: Shape

Trait Implementations§

source§

impl<'a, 'b> Add<&'b ComplexMatrix> for &'a ComplexMatrix

source§

type Output = ComplexMatrix

The resulting type after applying the + operator.
source§

fn add(self, rhs: &'b ComplexMatrix) -> Self::Output

Performs the + operation. Read more
source§

impl<'a> Add<&'a ComplexMatrix> for C64

Element-wise addition between C64 & &ComplexMatrix

source§

type Output = ComplexMatrix

The resulting type after applying the + operator.
source§

fn add(self, other: &'a ComplexMatrix) -> Self::Output

Performs the + operation. Read more
source§

impl Add<ComplexMatrix> for C64

§Examples

#[macro_use]
extern crate peroxide;
use peroxide::fuga::*;
use peroxide::complex::matrix::*;

fn main() {
    let mut a = ml_cmatrix("1.0+1.0i 2.0+2.0i;
                                   4.0+4.0i 5.0+5.0i");
    let a_exp = ml_cmatrix("2.0+2.0i 3.0+3.0i;
                                   5.0+5.0i 6.0+6.0i");
    assert_eq!(C64::new(1_f64, 1_f64) + a, a_exp);
}
source§

type Output = ComplexMatrix

The resulting type after applying the + operator.
source§

fn add(self, other: ComplexMatrix) -> Self::Output

Performs the + operation. Read more
source§

impl<'a, T> Add<T> for &'a ComplexMatrix
where T: Into<C64> + Copy,

Element-wise addition between &ComplexMatrix & C64

source§

type Output = ComplexMatrix

The resulting type after applying the + operator.
source§

fn add(self, other: T) -> Self::Output

Performs the + operation. Read more
source§

impl<T> Add<T> for ComplexMatrix
where T: Into<C64> + Copy,

Element-wise addition between Complex Matrix & C64

§Examples

#[macro_use]
extern crate peroxide;
use peroxide::fuga::*;
use peroxide::complex::matrix::*;

fn main() {
    let mut a = ml_cmatrix("1.0+1.0i 2.0+2.0i;
                                   4.0+4.0i 5.0+5.0i");
    let a_exp = ml_cmatrix("2.0+2.0i 3.0+3.0i;
                                   5.0+5.0i 6.0+6.0i");
    assert_eq!(a + C64::new(1_f64, 1_f64), a_exp);
}
source§

type Output = ComplexMatrix

The resulting type after applying the + operator.
source§

fn add(self, other: T) -> Self

Performs the + operation. Read more
source§

impl Add for ComplexMatrix

Element-wise addition of Complex Matrix

§Caution

You should remember ownership. If you use ComplexMatrix a,b then you can’t use them after.

source§

type Output = ComplexMatrix

The resulting type after applying the + operator.
source§

fn add(self, other: Self) -> Self

Performs the + operation. Read more
source§

impl Clone for ComplexMatrix

source§

fn clone(&self) -> ComplexMatrix

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ComplexMatrix

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for ComplexMatrix

source§

fn default() -> ComplexMatrix

Returns the “default value” for a type. Read more
source§

impl Display for ComplexMatrix

Pretty Print

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Div<Complex<f64>> for &'a ComplexMatrix

source§

type Output = ComplexMatrix

The resulting type after applying the / operator.
source§

fn div(self, other: C64) -> Self::Output

Performs the / operation. Read more
source§

impl Div<Complex<f64>> for ComplexMatrix

Element-wise division between Complex Matrix vs C64

source§

type Output = ComplexMatrix

The resulting type after applying the / operator.
source§

fn div(self, other: C64) -> Self::Output

Performs the / operation. Read more
source§

impl ExpLogOps for ComplexMatrix

source§

type Float = Complex<f64>

source§

fn exp(&self) -> Self

source§

fn ln(&self) -> Self

source§

fn log(&self, base: Self::Float) -> Self

source§

fn log2(&self) -> Self

source§

fn log10(&self) -> Self

source§

impl FPMatrix for ComplexMatrix

source§

fn col_map<F>(&self, f: F) -> ComplexMatrix
where F: Fn(Vec<C64>) -> Vec<C64>,

Column map

§Example
use peroxide::fuga::*;
use peroxide::complex::matrix::*;
use peroxide::traits::fp::FPMatrix;

fn main() {
    let x = cmatrix(vec![C64::new(1f64, 1f64),
                                C64::new(2f64, 2f64),
                                C64::new(3f64, 3f64),
                                C64::new(4f64, 4f64)],
                            2, 2, Row
    );
    let y = x.col_map(|r| r.fmap(|t| t + r[0]));

    let y_col_map = cmatrix(vec![C64::new(2f64, 2f64),
                                        C64::new(4f64, 4f64),
                                        C64::new(4f64, 4f64),
                                        C64::new(6f64, 6f64)],
                            2, 2, Col
    );

    assert_eq!(y, y_col_map);
}
source§

fn row_map<F>(&self, f: F) -> ComplexMatrix
where F: Fn(Vec<C64>) -> Vec<C64>,

Row map

§Example
use peroxide::fuga::*;
use peroxide::complex::matrix::*;
use peroxide::traits::fp::FPMatrix;

fn main() {
    let x = cmatrix(vec![C64::new(1f64, 1f64),
                                C64::new(2f64, 2f64),
                                C64::new(3f64, 3f64),
                                C64::new(4f64, 4f64)],
                            2, 2, Row
    );
    let y = x.row_map(|r| r.fmap(|t| t + r[0]));

    let y_row_map = cmatrix(vec![C64::new(2f64, 2f64),
                                        C64::new(3f64, 3f64),
                                        C64::new(6f64, 6f64),
                                        C64::new(7f64, 7f64)],
                            2, 2, Row
    );

    assert_eq!(y, y_row_map);
}
source§

type Scalar = Complex<f64>

source§

fn take_row(&self, n: usize) -> Self

source§

fn take_col(&self, n: usize) -> Self

source§

fn skip_row(&self, n: usize) -> Self

source§

fn skip_col(&self, n: usize) -> Self

source§

fn fmap<F>(&self, f: F) -> Self
where F: Fn(C64) -> C64,

source§

fn col_mut_map<F>(&mut self, f: F)
where F: Fn(Vec<C64>) -> Vec<C64>,

source§

fn row_mut_map<F>(&mut self, f: F)
where F: Fn(Vec<C64>) -> Vec<C64>,

source§

fn reduce<F, T>(&self, init: T, f: F) -> C64
where F: Fn(C64, C64) -> C64, T: Into<C64>,

source§

fn zip_with<F>(&self, f: F, other: &ComplexMatrix) -> Self
where F: Fn(C64, C64) -> C64,

source§

fn col_reduce<F>(&self, f: F) -> Vec<C64>
where F: Fn(Vec<C64>) -> C64,

source§

fn row_reduce<F>(&self, f: F) -> Vec<C64>
where F: Fn(Vec<C64>) -> C64,

source§

impl Index<(usize, usize)> for ComplexMatrix

Index for Complex Matrix

(usize, usize) -> C64

§Examples

extern crate peroxide;
use peroxide::fuga::*;
use peroxide::complex::matrix::*;

let a = cmatrix(vec![C64::new(1f64, 1f64),
                            C64::new(2f64, 2f64),
                            C64::new(3f64, 3f64),
                            C64::new(4f64, 4f64)],
                            2, 2, Row
    );
assert_eq!(a[(0,1)], C64::new(2f64, 2f64));
source§

type Output = Complex<f64>

The returned type after indexing.
source§

fn index(&self, pair: (usize, usize)) -> &C64

Performs the indexing (container[index]) operation. Read more
source§

impl IndexMut<(usize, usize)> for ComplexMatrix

IndexMut for Complex Matrix (Assign)

(usize, usize) -> C64

§Examples

extern crate peroxide;
use peroxide::fuga::*;
use peroxide::complex::matrix::*;

let mut a = cmatrix(vec![C64::new(1f64, 1f64),
                            C64::new(2f64, 2f64),
                            C64::new(3f64, 3f64),
                            C64::new(4f64, 4f64)],
                            2, 2, Row
    );
assert_eq!(a[(0,1)], C64::new(2f64, 2f64));
source§

fn index_mut(&mut self, pair: (usize, usize)) -> &mut C64

Performs the mutable indexing (container[index]) operation. Read more
source§

impl InnerProduct for ComplexMatrix

Frobenius inner product

source§

fn dot(&self, rhs: &Self) -> C64

source§

impl<'a> Into<&'a Vec<Complex<f64>>> for &'a ComplexMatrix

&ComplexMatrix to &Vec<C64>

source§

fn into(self) -> &'a Vec<C64>

Converts this type into the (usually inferred) input type.
source§

impl Into<ComplexMatrix> for &Vec<C64>

&Vec<C64> to ComplexMatrix

source§

fn into(self) -> ComplexMatrix

Converts this type into the (usually inferred) input type.
source§

impl Into<ComplexMatrix> for Vec<C64>

Vec<C64> to ComplexMatrix

source§

fn into(self) -> ComplexMatrix

Converts this type into the (usually inferred) input type.
source§

impl Into<Vec<Complex<f64>>> for ComplexMatrix

Complex Matrix to Vec<C64>

source§

fn into(self) -> Vec<C64>

Converts this type into the (usually inferred) input type.
source§

impl LinearAlgebra<ComplexMatrix> for ComplexMatrix

source§

fn back_subs(&self, b: &[C64]) -> Vec<C64>

Backward Substitution for Upper Triangular

source§

fn forward_subs(&self, b: &[C64]) -> Vec<C64>

Forward substitution for Lower Triangular

source§

fn lu(&self) -> PQLU<ComplexMatrix>

LU Decomposition Implements (Complete Pivot)

§Description

It use complete pivoting LU decomposition. You can get two permutations, and LU matrices.

§Caution

It returns Option<PQLU> - You should unwrap to obtain real value. PQLU has four field - p, q, l, u. p, q are permutations. l, u are matrices.

§Examples
#[macro_use]
use peroxide::fuga::*;
use peroxide::complex::matrix::*;

fn main() {
    let a = cmatrix(vec![
            C64::new(1f64, 1f64),
            C64::new(2f64, 2f64),
            C64::new(3f64, 3f64),
            C64::new(4f64, 4f64)
        ],
        2, 2, Row
    );

    let l_exp = cmatrix(vec![
            C64::new(1f64, 0f64),
            C64::new(0f64, 0f64),
            C64::new(0.5f64, -0.0f64),
            C64::new(1f64, 0f64)
        ],
        2, 2, Row
    );

    let u_exp = cmatrix(vec![
            C64::new(4f64, 4f64),
            C64::new(3f64, 3f64),
            C64::new(0f64, 0f64),
            C64::new(-0.5f64, -0.5f64)
        ],
        2, 2, Row
    );
    let pqlu = a.lu();
    let (p,q,l,u) = (pqlu.p, pqlu.q, pqlu.l, pqlu.u);
    assert_eq!(p, vec![1]); // swap 0 & 1 (Row)
    assert_eq!(q, vec![1]); // swap 0 & 1 (Col)
    assert_eq!(l, l_exp);
    assert_eq!(u, u_exp);
}
source§

fn det(&self) -> C64

Determinant

§Examples
#[macro_use]
use peroxide::fuga::*;
use peroxide::complex::matrix::*;

fn main() {
    let a = cmatrix(vec![
            C64::new(1f64, 1f64),
            C64::new(2f64, 2f64),
            C64::new(3f64, 3f64),
            C64::new(4f64, 4f64)
        ],
        2, 2, Row
    );
    assert_eq!(a.det().norm(), 4f64);
}
source§

fn block(&self) -> (Self, Self, Self, Self)

Block Partition

§Examples
#[macro_use]
extern crate peroxide;
use peroxide::fuga::*;
use peroxide::complex::matrix::*;

fn main() {
    let a = cmatrix(vec![
            C64::new(1f64, 1f64),
            C64::new(2f64, 2f64),
            C64::new(3f64, 3f64),
            C64::new(4f64, 4f64)
        ],
        2, 2, Row
    );
    let (m1, m2, m3, m4) = a.block();
    assert_eq!(m1, ml_cmatrix("1.0+1.0i"));
    assert_eq!(m2, ml_cmatrix("2.0+2.0i"));
    assert_eq!(m3, ml_cmatrix("3.0+3.0i"));
    assert_eq!(m4, ml_cmatrix("4.0+4.0i"));
}
source§

fn inv(&self) -> Self

Inverse of Matrix

§Caution

inv function returns Option<Matrix> Thus, you should use pattern matching or unwrap to obtain inverse.

§Examples
#[macro_use]
extern crate peroxide;
use peroxide::fuga::*;
use peroxide::complex::matrix::*;

fn main() {
    // Non-singular
    let a = cmatrix(vec![
            C64::new(1f64, 1f64),
            C64::new(2f64, 2f64),
            C64::new(3f64, 3f64),
            C64::new(4f64, 4f64)
        ],
        2, 2, Row
    );

    let a_inv_exp = cmatrix(vec![
            C64::new(-1.0f64, 1f64),
            C64::new(0.5f64, -0.5f64),
            C64::new(0.75f64, -0.75f64),
            C64::new(-0.25f64, 0.25f64)
        ],
        2, 2, Row
    );
    assert_eq!(a.inv(), a_inv_exp);
}
source§

fn solve(&self, b: &[C64], sk: SolveKind) -> Vec<C64>

Solve with Vector

§Solve options
  • LU: Gaussian elimination with Complete pivoting LU (GECP)
  • WAZ: Solve with WAZ decomposition
source§

fn waz(&self, _d_form: Form) -> Option<WAZD<ComplexMatrix>>

source§

fn qr(&self) -> QR<ComplexMatrix>

source§

fn svd(&self) -> SVD<ComplexMatrix>

source§

fn cholesky(&self, uplo: UPLO) -> ComplexMatrix

source§

fn rref(&self) -> ComplexMatrix

source§

fn pseudo_inv(&self) -> ComplexMatrix

source§

fn solve_mat(&self, m: &ComplexMatrix, sk: SolveKind) -> ComplexMatrix

source§

fn is_symmetric(&self) -> bool

source§

impl LinearOp<Vec<Complex<f64>>, Vec<Complex<f64>>> for ComplexMatrix

TODO: Transpose Matrix as Linear operator for Vector

source§

fn apply(&self, other: &Vec<C64>) -> Vec<C64>

source§

impl MatrixProduct for ComplexMatrix

source§

fn kronecker(&self, other: &Self) -> Self

source§

fn hadamard(&self, other: &Self) -> Self

source§

impl MatrixTrait for ComplexMatrix

source§

fn ptr(&self) -> *const C64

Raw pointer for self.data

source§

fn mut_ptr(&mut self) -> *mut C64

Raw mutable pointer for self.data

source§

fn as_slice(&self) -> &[C64]

Slice of self.data

§Examples
use peroxide::fuga::*;
use peroxide::complex::matrix::*;

let a = cmatrix(vec![C64::new(1f64, 1f64),
                            C64::new(2f64, 2f64),
                            C64::new(3f64, 3f64),
                            C64::new(4f64, 4f64)],
                            2, 2, Row
    );
let b = a.as_slice();
assert_eq!(b, &[C64::new(1f64, 1f64),
                C64::new(2f64, 2f64),
                C64::new(3f64, 3f64),
                C64::new(4f64, 4f64)]);
source§

fn as_mut_slice(&mut self) -> &mut [C64]

Mutable slice of self.data

§Examples
use peroxide::fuga::*;
use peroxide::complex::matrix::*;

let mut a = cmatrix(vec![C64::new(1f64, 1f64),
                                C64::new(2f64, 2f64),
                                C64::new(3f64, 3f64),
                                C64::new(4f64, 4f64)],
                            2, 2, Row
    );
let mut b = a.as_mut_slice();
b[1] = C64::new(5f64, 5f64);
assert_eq!(b, &[C64::new(1f64, 1f64),
                C64::new(5f64, 5f64),
                C64::new(3f64, 3f64),
                C64::new(4f64, 4f64)]);
assert_eq!(a, cmatrix(vec![C64::new(1f64, 1f64),
                                  C64::new(5f64, 5f64),
                                  C64::new(3f64, 3f64),
                                  C64::new(4f64, 4f64)],
                              2, 2, Row));
source§

fn change_shape(&self) -> Self

Change Bindings

Row -> Col or Col -> Row

§Examples
use peroxide::fuga::*;
use peroxide::complex::matrix::*;

let mut a = cmatrix(vec![C64::new(1f64, 1f64),
                                C64::new(2f64, 2f64),
                                C64::new(3f64, 3f64),
                                C64::new(4f64, 4f64)],
                            2, 2, Row
    );
assert_eq!(a.shape, Row);
let b = a.change_shape();
assert_eq!(b.shape, Col);
source§

fn change_shape_mut(&mut self)

Change Bindings Mutably

Row -> Col or Col -> Row

§Examples
use peroxide::fuga::*;
use peroxide::complex::matrix::*;

let mut a = cmatrix(vec![
        C64::new(1f64, 1f64),
        C64::new(2f64, 2f64),
        C64::new(3f64, 3f64),
        C64::new(4f64, 4f64)
    ],
    2, 2, Row
);
assert_eq!(a.shape, Row);
a.change_shape_mut();
assert_eq!(a.shape, Col);
source§

fn spread(&self) -> String

Spread data(1D vector) to 2D formatted String

§Examples
use peroxide::fuga::*;
use peroxide::complex::matrix::*;

let a = cmatrix(vec![C64::new(1f64, 1f64),
                                C64::new(2f64, 2f64),
                                C64::new(3f64, 3f64),
                                C64::new(4f64, 4f64)],
                            2, 2, Row
    );
println!("{}", a.spread()); // same as println!("{}", a);
// Result:
//       c[0]    c[1]
// r[0]  1+1i    3+3i
// r[1]  2+2i    4+4i
source§

fn col(&self, index: usize) -> Vec<C64>

Extract Column

§Examples
#[macro_use]
extern crate peroxide;
use peroxide::fuga::*;
use peroxide::complex::matrix::*;

fn main() {
    let a = cmatrix(vec![C64::new(1f64, 1f64),
                            C64::new(2f64, 2f64),
                            C64::new(3f64, 3f64),
                            C64::new(4f64, 4f64)],
                            2, 2, Row
        );
    assert_eq!(a.col(0), vec![C64::new(1f64, 1f64), C64::new(3f64, 3f64)]);
}
source§

fn row(&self, index: usize) -> Vec<C64>

Extract Row

§Examples
#[macro_use]
extern crate peroxide;
use peroxide::fuga::*;
use peroxide::complex::matrix::*;

fn main() {
    let a = cmatrix(vec![C64::new(1f64, 1f64),
                            C64::new(2f64, 2f64),
                            C64::new(3f64, 3f64),
                            C64::new(4f64, 4f64)],
                            2, 2, Row
        );
    assert_eq!(a.row(0), vec![C64::new(1f64, 1f64), C64::new(2f64, 2f64)]);
}
source§

fn diag(&self) -> Vec<C64>

Extract diagonal components

§Examples
#[macro_use]
extern crate peroxide;
use peroxide::fuga::*;
use peroxide::complex::matrix::*;

fn main() {
    let a = cmatrix(vec![C64::new(1f64, 1f64),
                                C64::new(2f64, 2f64),
                                C64::new(3f64, 3f64),
                                C64::new(4f64, 4f64)],
                            2, 2, Row
         );
    assert_eq!(a.diag(), vec![C64::new(1f64, 1f64) ,C64::new(4f64, 4f64)]);
}
source§

fn transpose(&self) -> Self

Transpose

§Examples
use peroxide::fuga::*;
use peroxide::complex::matrix::*;

let a = cmatrix(vec![C64::new(1f64, 1f64),
                            C64::new(2f64, 2f64),
                            C64::new(3f64, 3f64),
                            C64::new(4f64, 4f64)],
                            2, 2, Row
    );
let a_t = cmatrix(vec![C64::new(1f64, 1f64),
                              C64::new(2f64, 2f64),
                              C64::new(3f64, 3f64),
                              C64::new(4f64, 4f64)],
                            2, 2, Col
    );

assert_eq!(a.transpose(), a_t);
source§

fn subs_col(&mut self, idx: usize, v: &[C64])

Substitute Col

source§

fn subs_row(&mut self, idx: usize, v: &[C64])

Substitute Row

source§

fn from_index<F, G>(f: F, size: (usize, usize)) -> ComplexMatrix
where F: Fn(usize, usize) -> G + Copy, G: Into<C64>,

From index operations

source§

fn to_vec(&self) -> Vec<Vec<C64>>

Matrix to Vec<Vec<C64>>

To send Matrix to inline-python

source§

fn submat(&self, start: (usize, usize), end: (usize, usize)) -> ComplexMatrix

Submatrix

§Description

Return below elements of complex matrix to a new complex matrix

$$ \begin{pmatrix} \ddots & & & & \\ & start & \cdots & end.1 & \\ & \vdots & \ddots & \vdots & \\ & end.0 & \cdots & end & \\ & & & & \ddots \end{pmatrix} $$

§Examples
#[macro_use]
extern crate peroxide;
use peroxide::fuga::*;
use peroxide::complex::matrix::*;

fn main() {
    let a = ml_cmatrix("1.0+1.0i 2.0+2.0i 3.0+3.0i;
                               4.0+4.0i 5.0+5.0i 6.0+6.0i;
                               7.0+7.0i 8.0+8.0i 9.0+9.0i");
    let b = cmatrix(vec![C64::new(5f64, 5f64),
                                C64::new(6f64, 6f64),
                                C64::new(8f64, 8f64),
                                C64::new(9f64, 9f64)],
                            2, 2, Row
    );
    let c = a.submat((1, 1), (2, 2));
    assert_eq!(b, c);
}
source§

fn subs_mat( &mut self, start: (usize, usize), end: (usize, usize), m: &ComplexMatrix, )

Substitute complex matrix to specific position

§Description

Substitute below elements of complex matrix

$$ \begin{pmatrix} \ddots & & & & \\ & start & \cdots & end.1 & \\ & \vdots & \ddots & \vdots & \\ & end.0 & \cdots & end & \\ & & & & \ddots \end{pmatrix} $$

§Examples
extern crate peroxide;
use peroxide::fuga::*;
use peroxide::complex::matrix::*;

fn main() {
    let mut a = ml_cmatrix("1.0+1.0i 2.0+2.0i 3.0+3.0i;
                               4.0+4.0i 5.0+5.0i 6.0+6.0i;
                               7.0+7.0i 8.0+8.0i 9.0+9.0i");
    let b = cmatrix(vec![C64::new(1f64, 1f64),
                                C64::new(2f64, 2f64),
                                C64::new(3f64, 3f64),
                                C64::new(4f64, 4f64)],
                            2, 2, Row);
    let c = ml_cmatrix("1.0+1.0i 2.0+2.0i 3.0+3.0i;
                               4.0+4.0i 1.0+1.0i 2.0+2.0i;
                               7.0+7.0i 3.0+3.0i 4.0+4.0i");
    a.subs_mat((1,1), (2,2), &b);
    assert_eq!(a, c);       
}
source§

type Scalar = Complex<f64>

source§

fn to_diag(&self) -> ComplexMatrix

source§

fn t(&self) -> Self

source§

impl<'a, 'b> Mul<&'b ComplexMatrix> for &'a ComplexMatrix

source§

type Output = ComplexMatrix

The resulting type after applying the * operator.
source§

fn mul(self, other: &'b ComplexMatrix) -> Self::Output

Performs the * operation. Read more
source§

impl<'a, 'b> Mul<&'b ComplexMatrix> for &'a Vec<C64>

source§

type Output = Vec<Complex<f64>>

The resulting type after applying the * operator.
source§

fn mul(self, other: &'b ComplexMatrix) -> Self::Output

Performs the * operation. Read more
source§

impl<'a> Mul<&'a ComplexMatrix> for C64

source§

type Output = ComplexMatrix

The resulting type after applying the * operator.
source§

fn mul(self, other: &'a ComplexMatrix) -> Self::Output

Performs the * operation. Read more
source§

impl<'a, 'b> Mul<&'b Vec<Complex<f64>>> for &'a ComplexMatrix

source§

type Output = Vec<Complex<f64>>

The resulting type after applying the * operator.
source§

fn mul(self, other: &'b Vec<C64>) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<Complex<f64>> for ComplexMatrix

Element-wise multiplication between Complex Matrix vs C64

source§

type Output = ComplexMatrix

The resulting type after applying the * operator.
source§

fn mul(self, other: C64) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<ComplexMatrix> for C64

source§

type Output = ComplexMatrix

The resulting type after applying the * operator.
source§

fn mul(self, other: ComplexMatrix) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<ComplexMatrix> for Vec<C64>

Matrix multiplication for Vec<C64> vs ComplexMatrix

source§

type Output = Vec<Complex<f64>>

The resulting type after applying the * operator.
source§

fn mul(self, other: ComplexMatrix) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<Vec<Complex<f64>>> for ComplexMatrix

source§

type Output = Vec<Complex<f64>>

The resulting type after applying the * operator.
source§

fn mul(self, other: Vec<C64>) -> Self::Output

Performs the * operation. Read more
source§

impl Mul for ComplexMatrix

Matrix Multiplication

§Examples

#[macro_use]
extern crate peroxide;
use peroxide::fuga::*;
use peroxide::complex::matrix::*;

fn main() {
    let mut a = ml_cmatrix("1.0+1.0i 2.0+2.0i;
                                   4.0+4.0i 5.0+5.0i");
    let mut b = ml_cmatrix("2.0+2.0i 2.0+2.0i;
                                   5.0+5.0i 5.0+5.0i");
    let prod = ml_cmatrix("0.0+24.0i 0.0+24.0i;
                                   0.0+66.0i 0.0+66.0i");
    assert_eq!(a * b, prod);
}
source§

type Output = ComplexMatrix

The resulting type after applying the * operator.
source§

fn mul(self, other: Self) -> Self::Output

Performs the * operation. Read more
source§

impl MutMatrix for ComplexMatrix

source§

type Scalar = Complex<f64>

source§

unsafe fn col_mut(&mut self, idx: usize) -> Vec<*mut C64>

source§

unsafe fn row_mut(&mut self, idx: usize) -> Vec<*mut C64>

source§

unsafe fn swap(&mut self, idx1: usize, idx2: usize, shape: Shape)

source§

unsafe fn swap_with_perm(&mut self, p: &Vec<(usize, usize)>, shape: Shape)

source§

impl<'a> Neg for &'a ComplexMatrix

Negation of &’a Complex Matrix

source§

type Output = ComplexMatrix

The resulting type after applying the - operator.
source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
source§

impl Neg for ComplexMatrix

Negation of Complex Matrix

§Examples

extern crate peroxide;
use peroxide::fuga::*;
use peroxide::complex::matrix::*;

let a = cmatrix(vec![C64::new(1f64, 1f64),
                            C64::new(2f64, 2f64),
                            C64::new(3f64, 3f64),
                            C64::new(4f64, 4f64)],
                            2, 2, Row);
let a_neg = cmatrix(vec![C64::new(-1f64, -1f64),
                                C64::new(-2f64, -2f64),
                                C64::new(-3f64, -3f64),
                                C64::new(-4f64, -4f64)],
                            2, 2, Row);
assert_eq!(-a, a_neg);
source§

type Output = ComplexMatrix

The resulting type after applying the - operator.
source§

fn neg(self) -> Self

Performs the unary - operation. Read more
source§

impl Normed for ComplexMatrix

source§

type UnsignedScalar = f64

source§

fn norm(&self, kind: Norm) -> Self::UnsignedScalar

source§

fn normalize(&self, _kind: Norm) -> Self
where Self: Sized,

source§

impl PartialEq for ComplexMatrix

PartialEq implements

source§

fn eq(&self, other: &ComplexMatrix) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PowOps for ComplexMatrix

source§

type Float = Complex<f64>

source§

fn powi(&self, n: i32) -> Self

source§

fn powf(&self, f: Self::Float) -> Self

source§

fn pow(&self, _f: Self) -> Self

source§

fn sqrt(&self) -> Self

source§

impl<'a, 'b> Sub<&'b ComplexMatrix> for &'a ComplexMatrix

source§

type Output = ComplexMatrix

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &'b ComplexMatrix) -> Self::Output

Performs the - operation. Read more
source§

impl<'a> Sub<&'a ComplexMatrix> for f64

source§

type Output = ComplexMatrix

The resulting type after applying the - operator.
source§

fn sub(self, other: &'a ComplexMatrix) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<ComplexMatrix> for C64

Subtraction Complex Matrix with C64

§Examples

#[macro_use]
extern crate peroxide;
use peroxide::fuga::*;
use peroxide::complex::matrix::*;

fn main() {
    let mut a = ml_cmatrix("1.0+1.0i 2.0+2.0i;
                                   4.0+4.0i 5.0+5.0i");
    let a_exp = ml_cmatrix("0.0+0.0i 1.0+1.0i;
                                   3.0+3.0i 4.0+4.0i");
    assert_eq!(a - C64::new(1_f64, 1_f64), a_exp);
}
source§

type Output = ComplexMatrix

The resulting type after applying the - operator.
source§

fn sub(self, other: ComplexMatrix) -> Self::Output

Performs the - operation. Read more
source§

impl<'a, T> Sub<T> for &'a ComplexMatrix
where T: Into<C64> + Copy,

Subtraction between &Complex Matrix & C64

source§

type Output = ComplexMatrix

The resulting type after applying the - operator.
source§

fn sub(self, other: T) -> Self::Output

Performs the - operation. Read more
source§

impl<T> Sub<T> for ComplexMatrix
where T: Into<C64> + Copy,

Subtraction between Complex Matrix & C64

source§

type Output = ComplexMatrix

The resulting type after applying the - operator.
source§

fn sub(self, other: T) -> Self::Output

Performs the - operation. Read more
source§

impl Sub for ComplexMatrix

Subtraction between Complex Matrix

§Examples

#[macro_use]
extern crate peroxide;
use peroxide::fuga::*;
use peroxide::complex::matrix::*;

fn main() {
    let a = ml_cmatrix("10.0+10.0i 20.0+20.0i;
                               40.0+40.0i 50.0+50.0i");
    let b = ml_cmatrix("1.0+1.0i 2.0+2.0i;
                               4.0+4.0i 5.0+5.0i");
    let diff = ml_cmatrix("9.0+9.0i 18.0+18.0i;
                                  36.0+36.0i 45.0+45.0i");
    assert_eq!(a-b, diff);
}
source§

type Output = ComplexMatrix

The resulting type after applying the - operator.
source§

fn sub(self, other: Self) -> Self::Output

Performs the - operation. Read more
source§

impl TrigOps for ComplexMatrix

source§

fn sin_cos(&self) -> (Self, Self)

source§

fn sin(&self) -> Self

source§

fn cos(&self) -> Self

source§

fn tan(&self) -> Self

source§

fn sinh(&self) -> Self

source§

fn cosh(&self) -> Self

source§

fn tanh(&self) -> Self

source§

fn asin(&self) -> Self

source§

fn acos(&self) -> Self

source§

fn atan(&self) -> Self

source§

fn asinh(&self) -> Self

source§

fn acosh(&self) -> Self

source§

fn atanh(&self) -> Self

§

fn asin_acos(&self) -> (Self, Self)

§

fn asinh_acosh(&self) -> (Self, Self)

source§

impl Vector for ComplexMatrix

source§

type Scalar = Complex<f64>

source§

fn add_vec(&self, other: &Self) -> Self

source§

fn sub_vec(&self, other: &Self) -> Self

source§

fn mul_scalar(&self, other: Self::Scalar) -> Self

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> Ungil for T
where T: Send,