return x = A^-1 b, assuming A is square and has full rank
324694
public Matrix solve(Matrix rhs) {
        if (M != N || rhs.M != N || rhs.N != 1) {
            throw new RuntimeException("Illegal matrix dimensions.");
        }

        // create copies of the data
        Matrix A = new Matrix(this);
        Matrix b = new Matrix(rhs);

        // Gaussian elimination with partial pivoting
        for (int i = 0; i < N; i++) {

            // find pivot row and swap
            int max = i;
            for (int j = i + 1; j < N; j++) {
                if (Math.abs(A.data[j][i]) > Math.abs(A.data[max][i])) {
                    max = j;
                }
            }
            A.swap(i, max);
            b.swap(i, max);

            // singular
            if (A.data[i][i] == 0.0) {
                throw new RuntimeException("Matrix is singular.");
            }

            // pivot within b
            for (int j = i + 1; j < N; j++) {
                b.data[j][0] -= b.data[i][0] * A.data[j][i] / A.data[i][i];
            }

            // pivot within A
            for (int j = i + 1; j < N; j++) {
                double m = A.data[j][i] / A.data[i][i];
                for (int k = i + 1; k < N; k++) {
                    A.data[j][k] -= A.data[i][k] * m;
                }
                A.data[j][i] = 0.0;
            }
        }

        // back substitution
        Matrix x = new Matrix(N, 1);
        for (int j = N - 1; j >= 0; j--) {
            double t = 0.0;
            for (int k = j + 1; k < N; k++) {
                t += A.data[j][k] * x.data[k][0];
            }
            x.data[j][0] = (b.data[j][0] - t) / A.data[j][j];
        }
        return x;

    }
899487
function(a, b)
{
    return (a.bb_l <= b.bb_r && b.bb_l <= a.bb_r && a.bb_b <= b.bb_t && b.bb_b <= a.bb_t);
}
711236
def nhill_i(self,x,threshold=0.1,power=2):
        
        x_pow = np.power(x,power)
        threshold_pow = np.power(threshold,power)
        return threshold_pow / (x_pow + threshold_pow) * (1 - x_pow)
1158930
def lrelu_sq(x):
    
    dim = len(x.get_shape()) - 1
    return tf.concat(dim, [lrelu(x), tf.minimum(tf.abs(x), tf.square(x))])
411350
def _sqrt(x):
    
    x = np.clip(x, a_min=0, a_max=None)

    try:
        return np.sqrt(x)
    except AttributeError:
        exponent = 0.5

        try:
            exponent = np.take(x, 0).from_float(exponent)
        except AttributeError:
            pass

        return x ** exponent
699402
def _call(self, x):
        """"""
        x_norm = self.__norm(x)

        if x_norm > 1:
            return np.inf
        else:
            return 0
23777
function() { 
            var a = this.clone(),
                i = 1,
                b = a.clone().diff(),
                c = a.clone().gcd(b),
                w = a.divide(c)[0];
            var output = Polynomial.fromArray([new Frac(1)], a.variable);
            while(!c.equalsNumber(1)) { 
                var y = w.gcd(c); 
                var z = w.divide(y)[0];
                //one of the factors may have shown up since it's square but smaller than the 
                //one where finding
                if(!z.equalsNumber(1) && i>1) {
                    var t = z.clone();
                    for(var j=1; j<i; j++)
                        t.multiply(z.clone());
                    z = t;
                }
                output = output.multiply(z); 
                i++;
                w = y;
                c = c.divide(y)[0];
            }
            return [output, w, i];
        }
17453
function ( x, a1, a2, b1, b2 ) {

		return b1 + ( x - a1 ) * ( b2 - b1 ) / ( a2 - a1 );

	}
221334
function lbeta(a, b) {
      if (a > b) { return lbeta(b, a); }
      // a <= b
      if (a < 0) { return NaN; }
      if (a === 0) { return Infinity; }
      if (b === Infinity) { return -Infinity; }
      if (a > 10) {
         return -0.5 * Math.log(b) + Math.log(sqrt2pi) +
                (stirlerr(a) + stirlerr(b) - stirlerr(a + b)) +
                (a - 0.5) * Math.log(a / (a + b)) +
                b * log1p(-a / (a + b));
      }
      if (b >= 10) {
         return lgamma(a) + (stirlerr(b) - stirlerr(a + b)) +
                a - a * Math.log(a + b) +
                (b - 0.5) * log1p(-a / (a + b));
      }
      return lgamma(a) + (lgamma(b) - lgamma(a + b));
   }
975286
def _call(self, x):
        """"""
        if self.operator is None:
            return self.vector.inner(x) + self.constant
        elif self.vector is None:
            return x.inner(self.operator(x)) + self.constant
        else:
            tmp = self.operator(x)
            tmp += self.vector
            return x.inner(tmp) + self.constant
711706
function(a, b){
			return (a._x < b._x + b._w && a._y < b._y + b._h 
					&& a._x + a._w > b._x && a._y + a._h > b._y)
		}
434964
def cummin(x):
    """"""
    for i in range(1, len(x)):
        if x[i-1] < x[i]:
            x[i] = x[i-1]
    return x
271604
function(_a, _b) {
    return Math.floor(Math.pow(parseFloat(_a), parseInt(_b)));
  }
838782
def mod_issquare(a, p):
    
    if not a:
        return True
    p1 = p // 2
    p2 = pow(a, p1, p)
    return p2 == 1
397368
def sqr(x, context=None):
    
    return _apply_function_in_current_context(
        BigFloat,
        mpfr.mpfr_sqr,
        (BigFloat._implicit_convert(x),),
        context,
    )
321901
def x(self):
        '''
        
        '''
        if None not in (self.x_min, self.x_max, self.x_step) and \
                self.x_min != self.x_max:
            x = np.arange(self.x_min, self.x_max+self.x_step-self.y_step*0.1, self.x_step)
        else:
            x = np.array([])
        return x
652366
def _B(self, x, a, b):
        
        return special.betainc(a, b, x) * special.beta(a, b)