Splits the projection matrix into a 3x3 matrix and 3x1 vector.

@param P (Input) 3x4 projection matirx
@param M (Output) M = P(:,0:2)
@param T (Output) T = P(:,3)
761669
public static void projectionSplit( DMatrixRMaj P , DMatrix3x3 M , DMatrix3 T ) {
		M.a11 = P.data[0]; M.a12 = P.data[1]; M.a13 = P.data[2 ]; T.a1 = P.data[3 ];
		M.a21 = P.data[4]; M.a22 = P.data[5]; M.a23 = P.data[6 ]; T.a2 = P.data[7 ];
		M.a31 = P.data[8]; M.a32 = P.data[9]; M.a33 = P.data[10]; T.a3 = P.data[11];
	}
1021354
public static void transpose( DMatrix3x3 m ) {
        double tmp;
        tmp = m.a12; m.a12 = m.a21; m.a21 = tmp;
        tmp = m.a13; m.a13 = m.a31; m.a31 = tmp;
        tmp = m.a23; m.a23 = m.a32; m.a32 = tmp;
    }
1240852
public static void byRow(Matrix m) {
        for (int i = 0; i < m.rows(); ++i) {
            double rowSum = 0;
            for (int j = 0; j < m.columns(); ++j)
                rowSum += m.get(i,j);

            // Skip row whose sume is zero.
            if (rowSum == 0) 
                continue;
            for (int j = 0; j < m.columns(); ++j)
                m.set(i,j, m.get(i,j) / rowSum);
        }
    }
1039241
public Matrix3 set (
        double m00, double m10, double m20,
        double m01, double m11, double m21,
        double m02, double m12, double m22) {
        this.m00 = m00; this.m01 = m01; this.m02 = m02;
        this.m10 = m10; this.m11 = m11; this.m12 = m12;
        this.m20 = m20; this.m21 = m21; this.m22 = m22;
        return this;
    }
1137907
private static void quadMult(final double a[], final double b[], final double result[]) {
        final double xs[] = new double[2];
        final double ys[] = new double[2];
        final double zs[] = new double[2];

        /* a[0] * b[0] */
        split(a[0], xs);
        split(b[0], ys);
        splitMult(xs, ys, zs);

        result[0] = zs[0];
        result[1] = zs[1];

        /* a[0] * b[1] */
        split(b[1], ys);
        splitMult(xs, ys, zs);

        double tmp = result[0] + zs[0];
        result[1] = result[1] - (tmp - result[0] - zs[0]);
        result[0] = tmp;
        tmp = result[0] + zs[1];
        result[1] = result[1] - (tmp - result[0] - zs[1]);
        result[0] = tmp;

        /* a[1] * b[0] */
        split(a[1], xs);
        split(b[0], ys);
        splitMult(xs, ys, zs);

        tmp = result[0] + zs[0];
        result[1] = result[1] - (tmp - result[0] - zs[0]);
        result[0] = tmp;
        tmp = result[0] + zs[1];
        result[1] = result[1] - (tmp - result[0] - zs[1]);
        result[0] = tmp;

        /* a[1] * b[0] */
        split(a[1], xs);
        split(b[1], ys);
        splitMult(xs, ys, zs);

        tmp = result[0] + zs[0];
        result[1] = result[1] - (tmp - result[0] - zs[0]);
        result[0] = tmp;
        tmp = result[0] + zs[1];
        result[1] = result[1] - (tmp - result[0] - zs[1]);
        result[0] = tmp;
    }
1099167
public static void constraintMatrix3x3( DMatrixRMaj L_3x6 ,
											DMatrixRMaj L_6x3 ) {

		int index = 0;
		for( int i = 0; i < 3; i++ ) {
			L_6x3.data[index++] = L_3x6.get(i,0);
			L_6x3.data[index++] = L_3x6.get(i,1);
			L_6x3.data[index++] = L_3x6.get(i,3);
		}
	}
552664
public static void transpose( DMatrix4x4 m ) {
        double tmp;
        tmp = m.a12; m.a12 = m.a21; m.a21 = tmp;
        tmp = m.a13; m.a13 = m.a31; m.a31 = tmp;
        tmp = m.a14; m.a14 = m.a41; m.a41 = tmp;
        tmp = m.a23; m.a23 = m.a32; m.a32 = tmp;
        tmp = m.a24; m.a24 = m.a42; m.a42 = tmp;
        tmp = m.a34; m.a34 = m.a43; m.a43 = tmp;
    }
293772
public static void convert(DMatrixD1 input , ZMatrixD1 output ) {
        if( input.numCols != output.numCols || input.numRows != output.numRows ) {
            throw new IllegalArgumentException("The matrices are not all the same dimension.");
        }

        Arrays.fill(output.data, 0, output.getDataLength(), 0);

        final int length = output.getDataLength();

        for( int i = 0; i < length; i += 2 ) {
            output.data[i] = input.data[i/2];
        }
    }
1238768
public static void mult(int size, DoubleVector x, DoubleMatrix A, 
		DoubleVector y, boolean isTransposed) {
	// isTransposed = false:	x = A * y
	// isTransposed = true:		x^t = y^t * A^t
	
	int i, j;
	
	if (!isTransposed) {
	    // for beta
	    // x = A * y
	    for (i = 0; i < size; i++) {	
		x.vect[i] = 0;
		for (j = 0; j < size; j++) {
		    x.vect[i] += A.mtrx[i][j] * y.vect[j];
		}
	    }
	    
	} else {
	    // for alpha
	    // x^t = y^t * A^t
	    for (i = 0; i < size; i++) {
		x.vect[i] = 0;
		for (j = 0; j < size; j++) {
		    x.vect[i] += y.vect[j] * A.mtrx[j][i];
		}
	    }	    
	}	
    }
205470
function transform(m) {
    // Identity matrix.
    if (m === undefined) {
        m = [1, 0, 0, 0, 1, 0, 0, 0, 1];
    } else {
        m = m.slice();
    }

    // Performs the 3x3 matrix multiplication of the current matrix with the input matrix a.
    function _mmult(a, m) {
        m = m.slice();

        var m0 = m[0];
        var m1 = m[1];
        var m2 = m[2];
        var m3 = m[3];
        var m4 = m[4];
        var m5 = m[5];
        var m6 = m[6];
        var m7 = m[7];
        var m8 = m[8];

        m[0] = a[0] * m0 + a[1] * m3;
        m[1] = a[0] * m1 + a[1] * m4;
        m[3] = a[3] * m0 + a[4] * m3;
        m[4] = a[3] * m1 + a[4] * m4;
        m[6] = a[6] * m0 + a[7] * m3 + m6;
        m[7] = a[6] * m1 + a[7] * m4 + m7;

        return transform(m);
    }

    return {
        matrix: function () {
            return m.slice();
        },

        clone: function () {
            return transform(m);
        },

        prepend: function (t) {
            if (t.matrix) {
                t = t.matrix();
            }
            return _mmult(m, t);
        },

        append: function (t) {
            if (t.matrix) {
                t = t.matrix();
            }
            return _mmult(t, m);
        },

        translate: function (x, y) {
            return _mmult([1, 0, 0, 0, 1, 0, x, y, 1], m);
        },

        scale: function (x, y) {
            if (y === undefined) {
                y = x;
            }
            return _mmult([x, 0, 0, 0, y, 0, 0, 0, 1], m);
        },

        skew: function (x, y) {
            if (y === undefined) {
                y = x;
            }
            var kx = Math.PI * x / 180.0;
            var ky = Math.PI * y / 180.0;
            return _mmult([1, Math.tan(ky), 0, -Math.tan(kx), 1, 0, 0, 0, 1], m);
        },

        rotate: function (angle) {
            var c = Math.cos(radians(angle));
            var s = Math.sin(radians(angle));
            return _mmult([c, s, 0, -s, c, 0, 0, 0, 1], m);
        },

        transformPoint: function (point) {
            var x = point.x;
            var y = point.y;
            return {x: x * m[0] + y * m[3] + m[6],
                y: x * m[1] + y * m[4] + m[7]};
        }
    };
}
173261
private Coordinate p( int i, double t ) {
        double px = 0;
        double py = 0;
        for( int j = -2; j <= 1; j++ ) {
            Coordinate coordinate = pts.get(i + j);
            px += b(j, t) * coordinate.x;
            py += b(j, t) * coordinate.y;
        }
        return new Coordinate(px, py);
    }
883012
def p_matrix(p):
    
    if len(p) == 3:
        p[0] = node.matrix()
    else:
        p[0] = node.matrix(p[2])
1268446
public Matrix getP() {
        Matrix P = new DenseMatrix(jpvt.length, jpvt.length);
        for (int i = 0; i < jpvt.length; i++) {
            P.set(jpvt[i], i, 1);
        }
        return P;
    }
232250
public final void setFromMatrix(Matrix4f m1) {
		double ww = 0.25f*(m1.m00 + m1.m11 + m1.m22 + m1.m33);

		if (ww >= 0) {
			if (ww >= EPS2) {
				this.w =  Math.sqrt(ww);
				ww =  0.25f/this.w;
				this.x = (m1.m21 - m1.m12)*ww;
				this.y = (m1.m02 - m1.m20)*ww;
				this.z = (m1.m10 - m1.m01)*ww;
				return;
			} 
		}
		else {
			this.w = 0;
			this.x = 0;
			this.y = 0;
			this.z = 1;
			return;
		}

		this.w = 0;
		ww = -0.5f*(m1.m11 + m1.m22);

		if (ww >= 0) {
			if (ww >= EPS2) {
				this.x =  Math.sqrt(ww);
				ww = 1.0f/(2.0f*this.x);
				this.y = m1.m10*ww;
				this.z = m1.m20*ww;
				return;
			}
		} else {
			this.x = 0;
			this.y = 0;
			this.z = 1;
			return;
		}

		this.x = 0;
		ww = 0.5f*(1.0f - m1.m22);

		if (ww >= EPS2) {
			this.y =  Math.sqrt(ww);
			this.z = m1.m21/(2.0f*this.y);
			return;
		}

		this.y = 0;
		this.z = 1;
	}
1216761
public Vector3f mulTransposePosition(Matrix4fc mat, Vector3f dest) {
        float rx = mat.m00() * x + mat.m01() * y + mat.m02() * z + mat.m03();
        float ry = mat.m10() * x + mat.m11() * y + mat.m12() * z + mat.m13();
        float rz = mat.m20() * x + mat.m21() * y + mat.m22() * z + mat.m23();
        dest.x = rx;
        dest.y = ry;
        dest.z = rz;
        return dest;
    }
681113
public boolean process( DMatrixRMaj P ) {
		if( !svd.decompose(P) )
			return false;

		svd.getU(Ut,true);
		svd.getV(V,false);
		double sv[] = svd.getSingularValues();

		SingularOps_DDRM.descendingOrder(Ut,true,sv,3,V,false);

		// compute W+, which is transposed and non-negative inverted
		for (int i = 0; i < 3; i++) {
			Wt.unsafe_set(i,i, 1.0/sv[i]);
		}

		// get the pseudo inverse
		// A+ = V*(W+)*U'
		CommonOps_DDRM.mult(V,Wt,tmp);
		CommonOps_DDRM.mult(tmp, Ut,PA);

		// Vector U, which is P*U = 0
		SpecializedOps_DDRM.subvector(V,0,3,V.numRows,false,0,ns);

		return true;
	}
1241915
public Matrix4d lerp(Matrix4dc other, double t, Matrix4d dest) {
        dest.m00 = m00 + (other.m00() - m00) * t;
        dest.m01 = m01 + (other.m01() - m01) * t;
        dest.m02 = m02 + (other.m02() - m02) * t;
        dest.m03 = m03 + (other.m03() - m03) * t;
        dest.m10 = m10 + (other.m10() - m10) * t;
        dest.m11 = m11 + (other.m11() - m11) * t;
        dest.m12 = m12 + (other.m12() - m12) * t;
        dest.m13 = m13 + (other.m13() - m13) * t;
        dest.m20 = m20 + (other.m20() - m20) * t;
        dest.m21 = m21 + (other.m21() - m21) * t;
        dest.m22 = m22 + (other.m22() - m22) * t;
        dest.m23 = m23 + (other.m23() - m23) * t;
        dest.m30 = m30 + (other.m30() - m30) * t;
        dest.m31 = m31 + (other.m31() - m31) * t;
        dest.m32 = m32 + (other.m32() - m32) * t;
        dest.m33 = m33 + (other.m33() - m33) * t;
        dest.properties = properties & other.properties();
        return dest;
    }