statkit.js
function hm(n, v, incv, offv, tau, b, offb) {
    // Apply householder transformation b = b - tau v v' b
    // LAPACK: DLARF

    if (tau === 0.0) {
      return;
    }

    // compute v' b
    var d = b[offb + 0];
    for (var i = 1; i < n; ++i) {
      d += b[offb + i] * v[offv + incv*i];
    }

    // compute b = b - tau v v' b
    b[offb + 0] -= tau * d;
    for (var i = 1; i < n; ++i) {
      b[offb + i] -= tau * v[offv + incv*i] * d;
    }
  }
function hm(n, v, incv, offv, tau, b, offb) {
    // Apply householder transformation b = b - tau v v' b
    // LAPACK: DLARF

    if (tau === 0.0) {
      return;
    }

    // compute v' b
    var d = b[offb + 0];
    for (var i = 1; i < n; ++i) {
      d += b[offb + i] * v[offv + incv*i];
    }

    // compute b = b - tau v v' b
    b[offb + 0] -= tau * d;
    for (var i = 1; i < n; ++i) {
      b[offb + i] -= tau * v[offv + incv*i] * d;
    }
  }
function hm ( n , v , incv , offv , tau , b , offb ) { // Apply householder transformation b = b - tau v v' b // LAPACK: DLARF if ( tau === 0.0 ) { return ; } // compute v' b var d = b [ offb + 0 ] ; for ( var i = 1 ; i < n ; ++ i ) { d += b [ offb + i ] * v [ offv + incv * i ] ; } // compute b = b - tau v v' b b [ offb + 0 ] -= tau * d ; for ( var i = 1 ; i < n ; ++ i ) { b [ offb + i ] -= tau * v [ offv + incv * i ] * d ; } }
Solve the least squares problem min ||Ax=b||
Solve the least squares problem min ||Ax = b||