Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Dec 6th, 2018 60 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1.  
  2. use nalgebra::{DMatrix};
  3. #[macro_use]
  4. extern crate ndarray;
  5. //use ndarray::Array;
  6. use ndarray::{Array,ArrayD, Dim, Ix, Ix2, IxDyn};
  7.  
  8.  
  9. fn main() {
  10.     let xdata = [0.05,  0.18,0.31, 0.42, 0.5];
  11.     let ydata = [0.12, 0.22,  0.35, 0.38, 0.49];
  12.     let dmaty = DMatrix::from_iterator(5,1,ydata.iter().cloned());
  13.     let dmat = DMatrix::from_iterator(5,1,xdata.iter().cloned());
  14.     let qr = dmat.qr();
  15.     let q = qr.q();
  16.     let r = qr.r();
  17.     println!("{}  {}",q,r);
  18.     let rinv = r.try_inverse().unwrap();
  19.     println!("{}",rinv.dot(&dmaty.transpose()));
  20. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top