fn covar(mut self) -> Self {
        /*
         * form the inverse of r in the full upper triangle of r.
         */
        let tolr = self.cfg.covtol * self.fjac[0].abs();
        let mut l: isize = -1;
        for k in 0..self.nfree {
            let k0 = k * self.m;
            let kk = k0 + k;
            if self.fjac[kk].abs() <= tolr {
                break;
            }
            self.fjac[kk] = 1.0 / self.fjac[kk];
            for j in 0..k {
                let kj = k0 + j;
                let temp = self.fjac[kk] * self.fjac[kj];
                self.fjac[kj] = 0.;
                let j0 = j * self.m;
                for i in 0..=j {
                    self.fjac[k0 + i] += -temp * self.fjac[j0 + i];
                }
            }
            l = k as isize;
        }
        /*
         * Form the full upper triangle of the inverse of (r transpose)*r
         * in the full upper triangle of r
         */
        if l >= 0 {
            let l = l as usize;
            for k in 0..=l {
                let k0 = k * self.m;
                for j in 0..k {
                    let temp = self.fjac[k0 + j];
                    let j0 = j * self.m;
                    for i in 0..=j {
                        self.fjac[j0 + i] += temp * self.fjac[k0 + i];
                    }
                }
                let temp = self.fjac[k0 + k];
                for i in 0..=k {
                    self.fjac[k0 + i] *= temp;
                }
            }
        }
        /*
         * For the full lower triangle of the covariance matrix
         * in the strict lower triangle or and in wa
         */
        for j in 0..self.nfree {
            let jj = self.ipvt[j];
            let sing = j as isize > l;
            let j0 = j * self.m;
            let jj0 = jj * self.m;
            for i in 0..=j {
                let ji = j0 + i;
                if sing {
                    self.fjac[ji] = 0.;
                }
                let ii = self.ipvt[i];
                if ii > jj {
                    self.fjac[jj0 + ii] = self.fjac[ji];
                }
                if ii < jj {
                    self.fjac[ii * self.m + jj] = self.fjac[ji];
                }
            }
            self.wa2[jj] = self.fjac[j0 + j];
        }
        /*
         * Symmetrize the covariance matrix in r
         */
        for j in 0..self.nfree {
            let j0 = j * self.m;
            for i in 0..j {
                self.fjac[j0 + i] = self.fjac[i * self.m + j];
            }
            self.fjac[j0 + j] = self.wa2[j];
        }
        self
    }
/// subroutine covar
///
/// given an m by n matrix a, the problem is to determine the covariance
/// matrix corresponding to a, defined as
///
/// inverse(a *a) .
///
/// this subroutine completes the solution of the problem if it is provided
/// with the necessary information from the qr factorization, with column
/// pivoting, of a. that is, if a*p = q*r, where p is a permutation matrix,
/// q has orthogonal columns, and r is an upper triangular matrix with
/// diagonal elements of nonincreasing magnitude, then covar expects the
/// full upper triangle of r and the permutation matrix p. the covariance
/// matrix is then computed as
///
/// p*inverse(r *r)*p  .
///
/// if a is nearly rank deficient, it may be desirable to compute the
/// covariance matrix corresponding to the linearly independent columns of
/// a. to define the numerical rank of a, covar uses the tolerance tol. if l
/// is the largest integer such that
///
/// abs(r(l,l)) .gt. tol*abs(r(1,1)) ,
///
/// then covar computes the covariance matrix corresponding to the first l
/// columns of r. for k greater than l, column and row ipvt(k) of the
/// covariance matrix are set to zero.
///
/// the subroutine statement is
///
/// subroutine covar(n,r,ldr,ipvt,tol,wa)
///
/// where
///
/// n is a positive integer input variable set to the order of r.
///
/// r is an n by n array. on input the full upper triangle must contain the
/// full upper triangle of the matrix r. on output r contains the square
/// symmetric covariance matrix.
///
/// ldr is a positive integer input variable not less than n which specifies
/// the leading dimension of the array r.
///
/// ipvt is an integer input array of length n which defines the permutation
/// matrix p such that a*p = q*r. column j of p is column ipvt(j) of the
/// identity matrix.
///
/// tol is a nonnegative input variable used to define the numerical rank of
/// a in the manner described above.
///
/// wa is a work array of length n.
subroutine covar
given an m by n matrix a, the problem is to determine the covariance
matrix corresponding to a, defined as



this subroutine completes the solution of the problem if it is provided
with the necessary information from the qr factorization, with column
pivoting, of a. that is, if a*p = q*r, where p is a permutation matrix,
q has orthogonal columns, and r is an upper triangular matrix with
diagonal elements of nonincreasing magnitude, then covar expects the
full upper triangle of r and the permutation matrix p. the covariance
matrix is then computed as



if a is nearly rank deficient, it may be desirable to compute the
covariance matrix corresponding to the linearly independent columns of
a. to define the numerical rank of a, covar uses the tolerance tol. if l
is the largest integer such that



then covar computes the covariance matrix corresponding to the first l
columns of r. for k greater than l, column and row ipvt(k) of the
covariance matrix are set to zero.

the subroutine statement is





n is a positive integer input variable set to the order of r.

r is an n by n array. on input the full upper triangle must contain the
full upper triangle of the matrix r. on output r contains the square
symmetric covariance matrix.

ldr is a positive integer input variable not less than n which specifies
the leading dimension of the array r.

ipvt is an integer input array of length n which defines the permutation
matrix p such that a*p = q*r. column j of p is column ipvt(j) of the
identity matrix.

tol is a nonnegative input variable used to define the numerical rank of
a in the manner described above.

wa is a work array of length n.
subroutine covar given an m by n matrix a the problem is to determine the covariance matrix corresponding to a defined as this subroutine completes the solution of the problem if it is provided with the necessary information from the qr factorization with column pivoting of a . that is if a * p = q * r where p is a permutation matrix q has orthogonal columns and r is an upper triangular matrix with diagonal elements of nonincreasing magnitude then covar expects the full upper triangle of r and the permutation matrix p . the covariance matrix is then computed as if a is nearly rank deficient it may be desirable to compute the covariance matrix corresponding to the linearly independent columns of a . to define the numerical rank of a covar uses the tolerance tol . if l is the largest integer such that then covar computes the covariance matrix corresponding to the first l columns of r . for k greater than l column and row ipvt ( k ) of the covariance matrix are set to zero . the subroutine statement is n is a positive integer input variable set to the order of r . r is an n by n array . on input the full upper triangle must contain the full upper triangle of the matrix r . on output r contains the square symmetric covariance matrix . ldr is a positive integer input variable not less than n which specifies the leading dimension of the array r . ipvt is an integer input array of length n which defines the permutation matrix p such that a * p = q * r . column j of p is column ipvt ( j ) of the identity matrix . tol is a nonnegative input variable used to define the numerical rank of a in the manner described above . wa is a work array of length n .
fn covar(mut self) -> Self {
        /*
         * form the inverse of r in the full upper triangle of r.
         */
        let tolr = self.cfg.covtol * self.fjac[0].abs();
        let mut l: isize = -1;
        for k in 0..self.nfree {
            let k0 = k * self.m;
            let kk = k0 + k;
            if self.fjac[kk].abs() <= tolr {
                break;
            }
            self.fjac[kk] = 1.0 / self.fjac[kk];
            for j in 0..k {
                let kj = k0 + j;
                let temp = self.fjac[kk] * self.fjac[kj];
                self.fjac[kj] = 0.;
                let j0 = j * self.m;
                for i in 0..=j {
                    self.fjac[k0 + i] += -temp * self.fjac[j0 + i];
                }
            }
            l = k as isize;
        }
        /*
         * Form the full upper triangle of the inverse of (r transpose)*r
         * in the full upper triangle of r
         */
        if l >= 0 {
            let l = l as usize;
            for k in 0..=l {
                let k0 = k * self.m;
                for j in 0..k {
                    let temp = self.fjac[k0 + j];
                    let j0 = j * self.m;
                    for i in 0..=j {
                        self.fjac[j0 + i] += temp * self.fjac[k0 + i];
                    }
                }
                let temp = self.fjac[k0 + k];
                for i in 0..=k {
                    self.fjac[k0 + i] *= temp;
                }
            }
        }
        /*
         * For the full lower triangle of the covariance matrix
         * in the strict lower triangle or and in wa
         */
        for j in 0..self.nfree {
            let jj = self.ipvt[j];
            let sing = j as isize > l;
            let j0 = j * self.m;
            let jj0 = jj * self.m;
            for i in 0..=j {
                let ji = j0 + i;
                if sing {
                    self.fjac[ji] = 0.;
                }
                let ii = self.ipvt[i];
                if ii > jj {
                    self.fjac[jj0 + ii] = self.fjac[ji];
                }
                if ii < jj {
                    self.fjac[ii * self.m + jj] = self.fjac[ji];
                }
            }
            self.wa2[jj] = self.fjac[j0 + j];
        }
        /*
         * Symmetrize the covariance matrix in r
         */
        for j in 0..self.nfree {
            let j0 = j * self.m;
            for i in 0..j {
                self.fjac[j0 + i] = self.fjac[i * self.m + j];
            }
            self.fjac[j0 + j] = self.wa2[j];
        }
        self
    }
fn covar ( mut self ) -> Self { /*
         * form the inverse of r in the full upper triangle of r.
         */ let tolr = self . cfg . covtol * self . fjac [ 0 ] . abs ( ) ; let mut l : isize = - 1 ; for k in 0 .. self . nfree { let k0 = k * self . m ; let kk = k0 + k ; if self . fjac [ kk ] . abs ( ) <= tolr { break ; } self . fjac [ kk ] = 1.0 / self . fjac [ kk ] ; for j in 0 .. k { let kj = k0 + j ; let temp = self . fjac [ kk ] * self . fjac [ kj ] ; self . fjac [ kj ] = 0. ; let j0 = j * self . m ; for i in 0 ..= j { self . fjac [ k0 + i ] += - temp * self . fjac [ j0 + i ] ; } } l = k as isize ; } /*
         * Form the full upper triangle of the inverse of (r transpose)*r
         * in the full upper triangle of r
         */ if l >= 0 { let l = l as usize ; for k in 0 ..= l { let k0 = k * self . m ; for j in 0 .. k { let temp = self . fjac [ k0 + j ] ; let j0 = j * self . m ; for i in 0 ..= j { self . fjac [ j0 + i ] += temp * self . fjac [ k0 + i ] ; } } let temp = self . fjac [ k0 + k ] ; for i in 0 ..= k { self . fjac [ k0 + i ] *= temp ; } } } /*
         * For the full lower triangle of the covariance matrix
         * in the strict lower triangle or and in wa
         */ for j in 0 .. self . nfree { let jj = self . ipvt [ j ] ; let sing = j as isize > l ; let j0 = j * self . m ; let jj0 = jj * self . m ; for i in 0 ..= j { let ji = j0 + i ; if sing { self . fjac [ ji ] = 0. ; } let ii = self . ipvt [ i ] ; if ii > jj { self . fjac [ jj0 + ii ] = self . fjac [ ji ] ; } if ii < jj { self . fjac [ ii * self . m + jj ] = self . fjac [ ji ] ; } } self . wa2 [ jj ] = self . fjac [ j0 + j ] ; } /*
         * Symmetrize the covariance matrix in r
         */ for j in 0 .. self . nfree { let j0 = j * self . m ; for i in 0 .. j { self . fjac [ j0 + i ] = self . fjac [ i * self . m + j ] ; } self . fjac [ j0 + j ] = self . wa2 [ j ] ; } self }
subroutine covar
given an m by n matrix a, the problem is to determine the covariance
matrix corresponding to a, defined as
subroutine covar given an m by n matrix a the problem is to determine the covariance matrix corresponding to a defined as
mut self
mut self