pub fn hessenberg<N, V, M>(m: &M) -> (M, M)
    where N: BaseFloat,
          V: Indexable<usize, N> + Norm<NormType = N>,
          M: Copy + Eye + ColumnSlice<V> + Transpose + Indexable<(usize, usize), N> +
             Mul<M, Output = M> {
    
    let mut h = *m;
    let (rows, cols) = h.shape();

    let mut q : M = Eye::new_identity(cols);

    if cols <= 2 {
        return (q, h);
    }

    for ite in 0 .. (cols - 2) {
        let mut v = h.column_slice(ite, ite + 1, rows);

        let alpha = Norm::norm(&v);

        unsafe {
            let x = v.unsafe_at(0);
            v.unsafe_set(0, x - alpha);
        }

        if !::is_zero(&v.normalize_mut()) {
            let p: M = householder_matrix(rows, ite + 1, v);

            q = q * p;
            h = p * h * p;
        }
    }

    (q, h)
}
/// Hessenberg
/// Returns the matrix m in Hessenberg form and the corresponding similarity transformation
///
/// # Arguments
/// * `m` - matrix to transform
///
/// # Returns
/// * First return value `q` - Similarity matrix p such that q * h * q^T = m
/// * Second return value `h` - Matrix m in Hessenberg form
Hessenberg
Returns the matrix m in Hessenberg form and the corresponding similarity transformation
Hessenberg Returns the matrix m in Hessenberg form and the corresponding similarity transformation
pub fn hessenberg<N, V, M>(m: &M) -> (M, M)
    where N: BaseFloat,
          V: Indexable<usize, N> + Norm<NormType = N>,
          M: Copy + Eye + ColumnSlice<V> + Transpose + Indexable<(usize, usize), N> +
             Mul<M, Output = M> {
    let mut h = *m;
    let (rows, cols) = h.shape();
    let mut q : M = Eye::new_identity(cols);
    if cols <= 2 {
        return (q, h);
    }
    for ite in 0 .. (cols - 2) {
        let mut v = h.column_slice(ite, ite + 1, rows);
        let alpha = Norm::norm(&v);
        unsafe {
            let x = v.unsafe_at(0);
            v.unsafe_set(0, x - alpha);
        }
        if !::is_zero(&v.normalize_mut()) {
            let p: M = householder_matrix(rows, ite + 1, v);
            q = q * p;
            h = p * h * p;
        }
    }
    (q, h)
}
pub fn hessenberg < N , V , M > ( m : & M ) -> ( M , M ) where N : BaseFloat , V : Indexable < usize , N > + Norm < NormType = N > , M : Copy + Eye + ColumnSlice < V > + Transpose + Indexable < ( usize , usize ) , N > + Mul < M , Output = M > { let mut h = * m ; let ( rows , cols ) = h . shape ( ) ; let mut q : M = Eye :: new_identity ( cols ) ; if cols <= 2 { return ( q , h ) ; } for ite in 0 .. ( cols - 2 ) { let mut v = h . column_slice ( ite , ite + 1 , rows ) ; let alpha = Norm :: norm ( & v ) ; unsafe { let x = v . unsafe_at ( 0 ) ; v . unsafe_set ( 0 , x - alpha ) ; } if ! :: is_zero ( & v . normalize_mut ( ) ) { let p : M = householder_matrix ( rows , ite + 1 , v ) ; q = q * p ; h = p * h * p ; } } ( q , h ) }
Hessenberg
Returns the matrix m in Hessenberg form and the corresponding similarity transformation
Hessenberg Returns the matrix m in Hessenberg form and the corresponding similarity transformation
m
&M
First return value `q` - Similarity matrix p such that q * h * q^T = m
Second return value `h` - Matrix m in Hessenberg form
First return value ` q ` - Similarity matrix p such that q * h * q^T = m Second return value ` h ` - Matrix m in Hessenberg form
m
&M