Function peroxide::complex::matrix::ml_cmatrix

source ·
pub fn ml_cmatrix(s: &str) -> ComplexMatrix
Expand description

Matlab-like matrix constructor

Note that the entries to the ml_cmatrix needs to be in the a+bi format without any spaces between the real and imaginary parts of the Complex number.

§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");
    let b = cmatrix(vec![C64::new(1f64, 1f64),
                                C64::new(2f64, 2f64),
                                C64::new(3f64, 3f64),
                                C64::new(4f64, 4f64)],
                            2, 2, Row
    );
    assert_eq!(a, b);
}