Multiply `c` by `m` - can adjust for rectangular shaped `c`.
170930
def _affine_mult(c:FlowField,m:AffineMatrix)->FlowField:
    ""
    if m is None: return c
    size = c.flow.size()
    h,w = c.size
    m[0,1] *= h/w
    m[1,0] *= w/h
    c.flow = c.flow.view(-1,2)
    c.flow = torch.addmm(m[:2,2], c.flow,  m[:2,:2].t()).view(size)
    return c
1299717
public void mul(Complex a, IMatrix result) {
        if ((result.rows != rows) || (result.columns != columns)) result.reshape(rows, columns);

        int i, j;
        for (i = 0; i < rows; i++)
            for (j = 0; j < columns; j++) {
                result.realmatrix[i][j] = realmatrix[i][j] * a.real - imagmatrix[i][j] * a.imag;
                result.imagmatrix[i][j] = realmatrix[i][j] * a.imag + imagmatrix[i][j] * a.real;
            }
    }
210066
function modifiedGramSchmidt (m) {
  const n = m.dimension;

  const v0 = m.getColumn(0);
  const u0 = v0;
  const v1 = m.getColumn(1);
  const u1 = v1.clone().sub(proj(u0, v1));
  if (n === 2) {
    m.setColumns(v0, v1);
    return;
  }
  const v2 = m.getColumn(2);
  const u2t = v2.clone().sub(proj(u0, v2));
  const u2 = u2t.sub(proj(u1, u2t));
  if (n === 3) {
    m.setColumns(u0, u1, u2);
    // return;
  }
}
1328780
function compit(ca,cb,aa,ab) {
            return (ca*aa + cb*ab * (1-aa)) / (aa+ab*(1-aa));
        }
1217654
def mod(self):
        """"""
        return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)
1293121
def _doublec(self, word):
        """"""
        if len(word) < 2:
            return False
        if (word[-1] != word[-2]):
            return False
        return self._cons(word, len(word)-1)
968104
public static void multAddColA(DMatrixSparseCSC A , int colA ,
                                   double alpha,
                                   DMatrixSparseCSC C, int mark,
                                   double x[] , int w[] ) {
        int idxA0 = A.col_idx[colA];
        int idxA1 = A.col_idx[colA+1];

        for (int j = idxA0; j < idxA1; j++) {
            int row = A.nz_rows[j];

            if( w[row] < mark ) {
                if( C.nz_length >= C.nz_rows.length ) {
                    C.growMaxLength(C.nz_length *2+1,true);
                }

                w[row] = mark;
                C.nz_rows[C.nz_length] = row;
                C.col_idx[mark] = ++C.nz_length;
                x[row] = A.nz_values[j]*alpha;
            } else {
                x[row] += A.nz_values[j]*alpha;
            }
        }
    }
1262064
def expand_squeeze_to_nd(x, n, squeeze_dim=2, expand_dim=-1):
  """"""
  if len(x.shape) > n:
    while len(x.shape) != n:
      x = tf.squeeze(x, [squeeze_dim])
  else:
    while len(x.shape) != n:
      x = tf.expand_dims(x, expand_dim)
  return x
643914
public ComplexFloat muli(ComplexFloat c, ComplexFloat result) {
    float newR = r * c.r - i * c.i;
    float newI = r * c.i + i * c.r;
    result.r = newR;
    result.i = newI;
    return result;
  }
177536
private static void adjustCalibrated(DMatrixRMaj rectifyLeft, DMatrixRMaj rectifyRight,
										 DMatrixRMaj rectifyK,
										 RectangleLength2D_F64 bound, double scale) {
		// translation
		double deltaX = -bound.x0*scale;
		double deltaY = -bound.y0*scale;

		// adjustment matrix
		SimpleMatrix A = new SimpleMatrix(3,3,true,new double[]{scale,0,deltaX,0,scale,deltaY,0,0,1});
		SimpleMatrix rL = SimpleMatrix.wrap(rectifyLeft);
		SimpleMatrix rR = SimpleMatrix.wrap(rectifyRight);
		SimpleMatrix K = SimpleMatrix.wrap(rectifyK);

		// remove previous calibration matrix
		SimpleMatrix K_inv = K.invert();
		rL = K_inv.mult(rL);
		rR = K_inv.mult(rR);

		// compute new calibration matrix and apply it
		K = A.mult(K);

		rectifyK.set(K.getDDRM());
		rectifyLeft.set(K.mult(rL).getDDRM());
		rectifyRight.set(K.mult(rR).getDDRM());
	}
700583
private static void adjustUncalibrated(FMatrixRMaj rectifyLeft, FMatrixRMaj rectifyRight,
										   RectangleLength2D_F32 bound, float scale) {
		// translation
		float deltaX = -bound.x0*scale;
		float deltaY = -bound.y0*scale;

		// adjustment matrix
		SimpleMatrix A = new SimpleMatrix(3,3,true,new float[]{scale,0,deltaX,0,scale,deltaY,0,0,1});
		SimpleMatrix rL = SimpleMatrix.wrap(rectifyLeft);
		SimpleMatrix rR = SimpleMatrix.wrap(rectifyRight);

		rectifyLeft.set(A.mult(rL).getFDRM());
		rectifyRight.set(A.mult(rR).getFDRM());
	}
374843
def cross_product(self, p1, p2):
        """"""
        return (p1.x * p2.y - p1.y * p2.x)
665784
private static double interpolateBilinear(final double c00, final double c01, final double c10, final double c11, final double mx, final double my){
		return (c00*(1.0-mx)+c10*(mx))*(1.0-my) + (c01*(1.0-mx)+c11*(mx))*(my);
	}
461974
def interpolate(v1, v2, t):
    '''
    '''
    return add(v1, mul(sub(v2, v1), t))
702319
def cmAccuracy(cm):
    
    # Increase floating point precision
    cm = cm.type(torch.float64)
    return cm.diag().sum() / (cm.sum() + 1e-15)
533367
public static void mult( double a[] , int offsetA ,
                             DMatrixSparseCSC B ,
                             double c[] , int offsetC )
    {
        if( a.length-offsetA < B.numRows)
            throw new IllegalArgumentException("Length of 'a' isn't long enough");
        if( c.length-offsetC < B.numCols)
            throw new IllegalArgumentException("Length of 'c' isn't long enough");

        for (int k = 0; k < B.numCols; k++) {
            int idx0 = B.col_idx[k  ];
            int idx1 = B.col_idx[k+1];

            double sum = 0;
            for (int indexB = idx0; indexB < idx1; indexB++) {
                sum += a[offsetA+B.nz_rows[indexB]]*B.nz_values[indexB];
            }
            c[offsetC+k] = sum;
        }
    }
100271
public Matrix multiply(double c, ExecutorService threadPool)
    {
        Matrix toReturn = getThisSideMatrix(null);
        toReturn.mutableMultiply(c, threadPool);
        return toReturn;
    }