Computes the N<sup>th</sup> root of a complex number in polar notation.  There are
N distinct N<sup>th</sup> roots.

@param a Complex number
@param N The root's magnitude
@param k Specifies which root.  0 &le; k &lt; N
@param result Computed root
498810
public static void root(ComplexPolar_F64 a , int N , int k , ComplexPolar_F64 result )
    {
        result.r = Math.pow(a.r,1.0/N);
        result.theta = (a.theta + 2.0*k* UtilEjml.PI)/N;
    }
1120176
@Override
    public void rot(long N, INDArray X, INDArray Y, double c, double s) {

        if (Nd4j.getExecutioner().getProfilingMode() == OpExecutioner.ProfilingMode.ALL)
            OpProfiler.getInstance().processBlasCall(false, X, Y);

        if (X.isSparse() && !Y.isSparse()) {
            Nd4j.getSparseBlasWrapper().level1().rot(N, X, Y, c, s);
        } else if (X.data().dataType() == DataType.DOUBLE) {
            DefaultOpExecutioner.validateDataType(DataType.DOUBLE, X, Y);
            drot(N, X, BlasBufferUtil.getBlasStride(X), Y, BlasBufferUtil.getBlasStride(X), c, s);
        } else {
            DefaultOpExecutioner.validateDataType(DataType.FLOAT, X, Y);
            srot(N, X, BlasBufferUtil.getBlasStride(X), Y, BlasBufferUtil.getBlasStride(X), (float) c, (float) s);
        }
    }
340054
public boolean process( DMatrixSparseCSC A ) {
        init(A);

        TriangularSolver_DSCC.eliminationTree(A,true,parent,gwork);

        countNonZeroInR(parent);
        countNonZeroInV(parent);

        // if more columns than rows it's possible that Q*R != A. That's because a householder
        // would need to be created that's outside the  m by m Q matrix. In reality it has
        // a partial solution. Column pivot are needed.
        if( m < n ) {
            for (int row = 0; row <m; row++) {
                if( gwork.data[head+row] < 0 ) {
                    return false;
                }
            }
        }
        return true;
    }
1175213
def LogBinomialCoef(n, k):
    
    return n * log(n) - k * log(k) - (n - k) * log(n - k)
927642
public static double choose(int n, int k) {
        if (n < 0 || k < 0) {
            throw new IllegalArgumentException(String.format("Invalid n = %d, k = %d", n, k));
        }

        if (n < k) {
            return 0.0;
        }

        return Math.floor(0.5 + Math.exp(logChoose(n, k)));
    }
202969
public ComplexDouble subi(ComplexDouble c, ComplexDouble result) {
    if (this == result) {
      r -= c.r;
      i -= c.i;
    } else {
      result.r = r - c.r;
      result.i = i - c.i;
    }
    return this;
  }
340829
function lchoose(n, k) {
      k = Math.round(k);
      if (utils.hasNaN(n, k)) { return NaN; }
      if (k < 0) { return -Infinity; }
      if (k === 0) { return 0; }
      if (k === 1) { return Math.log(Math.abs(n)); }
      if (n < 0) { return lchoose(-n + k - 1, k); }
      if (n === Math.round(n)) {
         if (n < k) { return -Infinity; }
         if (n - k < 2) { return lchoose(n, n - k); }

         return lfastchoose(n, k);
      }
      if (n < k - 1) { return lfastchoose2(n, k); }

      return lfastchoose(n, k);
   }
583174
private boolean rotateUntilInLowerCorner(Result result) {
		// sanity check corners.  There should only be one exactly one black
		final int topLeft = getTotalGridElements() - gridWidth;
		final int topRight = getTotalGridElements() - 1;
		final int bottomLeft = 0;
		final int bottomRight = gridWidth - 1;

		if (classified[bottomLeft] + classified[bottomRight] + classified[topRight] + classified[topLeft] != 1)
			return true;

		// Rotate until the black corner is in the lower left hand corner on the image.
		// remember that origin is the top left corner
		result.rotation = 0;
		while (classified[topLeft] != 1) {
			result.rotation++;
			rotateClockWise();
		}
		return false;
	}
1183188
public static void plus(Complex_F64 a , Complex_F64 b , Complex_F64 result ) {
        result.real = a.real + b.real;
        result.imaginary = a.imaginary + b.imaginary;
    }
1010342
public static ComplexNumber Pow(ComplexNumber z1, double n) {

        double norm = Math.pow(z1.getMagnitude(), n);
        double angle = 360 - Math.abs(Math.toDegrees(Math.atan(z1.imaginary / z1.real)));

        double common = n * angle;

        double r = norm * Math.cos(Math.toRadians(common));
        double i = norm * Math.sin(Math.toRadians(common));

        return new ComplexNumber(r, i);

    }
482961
function(n, k) {

    var p = 1;
    for (k = n - k; k < n; n--) {
      p *= n;
    }
    return p;
  }
271452
function() {

      // acsch(c) = log((1+sqrt(1+c^2))/c)

      var a = this['re'];
      var b = this['im'];

      if (b === 0) {

        return new Complex(
                (a !== 0)
                ? Math.log(a + Math.sqrt(a * a + 1))
                : Infinity, 0);
      }

      var d = a * a + b * b;
      return (d !== 0)
              ? new Complex(
                      a / d,
                      -b / d).asinh()
              : new Complex(
                      (a !== 0) ? a / 0 : 0,
                      (b !== 0) ? -b / 0 : 0).asinh();
    }
34046
public void mul(Complex c) {
        double newreal = real * c.real - imag * c.imag;
        double newimag = real * c.imag + imag * c.real;
        real = newreal;
        imag = newimag;
    }
1217530
private final int m() {
        int n = 0;
        int i = 0;
        for (; cons(i); ++i) {
            if (i > j)
                return n;
        }
        i++;
        while(i <= j) {
            for (; !cons(i); ++i) {
                if (i > j)
                    return n;
            }
            i++;
            n++;

            if (i > j)
                return n;
            for (; cons(i); ++i) {
                if (i > j)
                    return n;
            }
            i++;
        }
        return n;
    }
932089
@Override
    public Complex_F64 computeDeterminant() {
        if( m != n )
            throw new IllegalArgumentException("Must be a square matrix.");

        double realRet = pivsign;
        double realImg = 0;

        int total = m*stride;
        for( int i = 0; i < total; i += stride + 2 ) {
            double real = dataLU[i];
            double imaginary = dataLU[i+1];

            double r = realRet*real - realImg*imaginary;
            double t = realRet*imaginary + realImg*real;

            realRet = r;
            realImg = t;
        }

        det.set(realRet,realImg);
        return det;
    }
922006
static public void xA(double[] result, double[] x, double[][] A) {
    for (int i = 0; i < result.length; i++) {
      result[i] = 0.0;
      for (int j = 0; j < result.length; j++) {
        result[i] += (x[j] * A[j][i]);
      }
    }
  }
1308817
public static void sqrt(Complex_F64 input, Complex_F64 root)
    {
        double r = input.getMagnitude();
        double a = input.real;

        root.real = Math.sqrt((r+a)/2.0);
        root.imaginary = Math.sqrt((r-a)/2.0);
        if( input.imaginary < 0 )
            root.imaginary = -root.imaginary;
    }