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
impl<'a, 'b> Add<&'b ComplexMatrix> for &'a ComplexMatrix
source§type Output = ComplexMatrix
type Output = ComplexMatrix
+
operator.source§impl<'a> Add<&'a ComplexMatrix> for C64
impl<'a> Add<&'a ComplexMatrix> for C64
Element-wise addition between C64 & &ComplexMatrix
source§type Output = ComplexMatrix
type Output = ComplexMatrix
+
operator.source§impl Add<ComplexMatrix> for C64
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
type Output = ComplexMatrix
+
operator.source§impl<'a, T> Add<T> for &'a ComplexMatrix
impl<'a, T> Add<T> for &'a ComplexMatrix
Element-wise addition between &ComplexMatrix & C64
source§impl<T> Add<T> for ComplexMatrix
impl<T> Add<T> for ComplexMatrix
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§impl Add for ComplexMatrix
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§impl Clone for ComplexMatrix
impl Clone for ComplexMatrix
source§fn clone(&self) -> ComplexMatrix
fn clone(&self) -> ComplexMatrix
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ComplexMatrix
impl Debug for ComplexMatrix
source§impl Default for ComplexMatrix
impl Default for ComplexMatrix
source§fn default() -> ComplexMatrix
fn default() -> ComplexMatrix
source§impl Display for ComplexMatrix
impl Display for ComplexMatrix
Pretty Print
source§impl ExpLogOps for ComplexMatrix
impl ExpLogOps for ComplexMatrix
source§impl FPMatrix for ComplexMatrix
impl FPMatrix for ComplexMatrix
source§fn col_map<F>(&self, f: F) -> ComplexMatrix
fn col_map<F>(&self, f: F) -> ComplexMatrix
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
fn row_map<F>(&self, f: F) -> ComplexMatrix
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);
}
type Scalar = Complex<f64>
fn take_row(&self, n: usize) -> Self
fn take_col(&self, n: usize) -> Self
fn skip_row(&self, n: usize) -> Self
fn skip_col(&self, n: usize) -> Self
fn fmap<F>(&self, f: F) -> Self
fn col_mut_map<F>(&mut self, f: F)
fn row_mut_map<F>(&mut self, f: F)
fn reduce<F, T>(&self, init: T, f: F) -> C64
fn zip_with<F>(&self, f: F, other: &ComplexMatrix) -> Self
fn col_reduce<F>(&self, f: F) -> Vec<C64>
fn row_reduce<F>(&self, f: F) -> Vec<C64>
source§impl Index<(usize, usize)> for ComplexMatrix
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§impl IndexMut<(usize, usize)> for ComplexMatrix
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§impl InnerProduct for ComplexMatrix
impl InnerProduct for ComplexMatrix
Frobenius inner product
source§impl Into<ComplexMatrix> for &Vec<C64>
impl Into<ComplexMatrix> for &Vec<C64>
&Vec<C64>
to ComplexMatrix
source§fn into(self) -> ComplexMatrix
fn into(self) -> ComplexMatrix
source§impl Into<ComplexMatrix> for Vec<C64>
impl Into<ComplexMatrix> for Vec<C64>
Vec<C64>
to ComplexMatrix
source§fn into(self) -> ComplexMatrix
fn into(self) -> ComplexMatrix
source§impl LinearAlgebra<ComplexMatrix> for ComplexMatrix
impl LinearAlgebra<ComplexMatrix> for ComplexMatrix
source§fn lu(&self) -> PQLU<ComplexMatrix>
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
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)
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
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>
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
fn waz(&self, _d_form: Form) -> Option<WAZD<ComplexMatrix>>
fn qr(&self) -> QR<ComplexMatrix>
fn svd(&self) -> SVD<ComplexMatrix>
fn cholesky(&self, uplo: UPLO) -> ComplexMatrix
fn rref(&self) -> ComplexMatrix
fn pseudo_inv(&self) -> ComplexMatrix
fn solve_mat(&self, m: &ComplexMatrix, sk: SolveKind) -> ComplexMatrix
fn is_symmetric(&self) -> bool
source§impl LinearOp<Vec<Complex<f64>>, Vec<Complex<f64>>> for ComplexMatrix
impl LinearOp<Vec<Complex<f64>>, Vec<Complex<f64>>> for ComplexMatrix
TODO: Transpose Matrix as Linear operator for Vector
source§impl MatrixProduct for ComplexMatrix
impl MatrixProduct for ComplexMatrix
source§impl MatrixTrait for ComplexMatrix
impl MatrixTrait for ComplexMatrix
source§fn as_slice(&self) -> &[C64]
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]
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
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)
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
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>
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>
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>
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
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 from_index<F, G>(f: F, size: (usize, usize)) -> ComplexMatrix
fn from_index<F, G>(f: F, size: (usize, usize)) -> ComplexMatrix
From index operations
source§fn submat(&self, start: (usize, usize), end: (usize, usize)) -> ComplexMatrix
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,
)
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);
}
type Scalar = Complex<f64>
fn to_diag(&self) -> ComplexMatrix
fn t(&self) -> Self
source§impl<'a, 'b> Mul<&'b ComplexMatrix> for &'a ComplexMatrix
impl<'a, 'b> Mul<&'b ComplexMatrix> for &'a ComplexMatrix
source§type Output = ComplexMatrix
type Output = ComplexMatrix
*
operator.source§impl<'a> Mul<&'a ComplexMatrix> for C64
impl<'a> Mul<&'a ComplexMatrix> for C64
source§type Output = ComplexMatrix
type Output = ComplexMatrix
*
operator.source§impl Mul<Complex<f64>> for ComplexMatrix
impl Mul<Complex<f64>> for ComplexMatrix
Element-wise multiplication between Complex Matrix vs C64
source§impl Mul<ComplexMatrix> for C64
impl Mul<ComplexMatrix> for C64
source§type Output = ComplexMatrix
type Output = ComplexMatrix
*
operator.source§impl Mul for ComplexMatrix
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§impl MutMatrix for ComplexMatrix
impl MutMatrix for ComplexMatrix
type Scalar = Complex<f64>
unsafe fn col_mut(&mut self, idx: usize) -> Vec<*mut C64>
unsafe fn row_mut(&mut self, idx: usize) -> Vec<*mut C64>
unsafe fn swap(&mut self, idx1: usize, idx2: usize, shape: Shape)
unsafe fn swap_with_perm(&mut self, p: &Vec<(usize, usize)>, shape: Shape)
source§impl<'a> Neg for &'a ComplexMatrix
impl<'a> Neg for &'a ComplexMatrix
Negation of &’a Complex Matrix
source§impl Neg for ComplexMatrix
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§impl Normed for ComplexMatrix
impl Normed for ComplexMatrix
source§impl PartialEq for ComplexMatrix
impl PartialEq for ComplexMatrix
PartialEq implements
source§impl PowOps for ComplexMatrix
impl PowOps for ComplexMatrix
source§impl<'a, 'b> Sub<&'b ComplexMatrix> for &'a ComplexMatrix
impl<'a, 'b> Sub<&'b ComplexMatrix> for &'a ComplexMatrix
source§type Output = ComplexMatrix
type Output = ComplexMatrix
-
operator.source§impl<'a> Sub<&'a ComplexMatrix> for f64
impl<'a> Sub<&'a ComplexMatrix> for f64
source§type Output = ComplexMatrix
type Output = ComplexMatrix
-
operator.source§impl Sub<ComplexMatrix> for C64
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
type Output = ComplexMatrix
-
operator.source§impl<'a, T> Sub<T> for &'a ComplexMatrix
impl<'a, T> Sub<T> for &'a ComplexMatrix
Subtraction between &Complex Matrix & C64
source§impl<T> Sub<T> for ComplexMatrix
impl<T> Sub<T> for ComplexMatrix
Subtraction between Complex Matrix & C64
source§impl Sub for ComplexMatrix
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§impl TrigOps for ComplexMatrix
impl TrigOps for ComplexMatrix
fn sin_cos(&self) -> (Self, Self)
fn sin(&self) -> Self
fn cos(&self) -> Self
fn tan(&self) -> Self
fn sinh(&self) -> Self
fn cosh(&self) -> Self
fn tanh(&self) -> Self
fn asin(&self) -> Self
fn acos(&self) -> Self
fn atan(&self) -> Self
fn asinh(&self) -> Self
fn acosh(&self) -> Self
fn atanh(&self) -> Self
fn asin_acos(&self) -> (Self, Self)
fn asinh_acosh(&self) -> (Self, Self)
Auto Trait Implementations§
impl Freeze for ComplexMatrix
impl RefUnwindSafe for ComplexMatrix
impl Send for ComplexMatrix
impl Sync for ComplexMatrix
impl Unpin for ComplexMatrix
impl UnwindSafe for ComplexMatrix
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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>
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>
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