Returns {@code asMatrix(image, flipChannels).ravel()}.
355843
public INDArray asRowVector(BufferedImage image, boolean flipChannels) throws IOException {
        return asMatrix(image, flipChannels).ravel();
    }
879773
def getMatrix(self):
        
        if self.mflag:
            m0 = 9.10938215e-31
            e0 = 1.602176487e-19
            c0 = 299792458.0
            rho = np.sqrt(self.gamma ** 2 - 1) * m0 * c0 / self.bend_field / e0
            theta = np.arcsin(self.bend_length / rho)
            self.bangle = theta

            m_rb_1 = transRbend(theta, rho, self.gamma, -1)
            m_rb_2 = transRbend(-theta, -rho, self.gamma, 1)
            m_rb_3 = transRbend(-theta, -rho, self.gamma, -1)
            m_rb_4 = transRbend(theta, rho, self.gamma, 1)
            m_df_12 = transDrift(self.dflist[0], self.gamma)
            m_df_23 = transDrift(self.dflist[1], self.gamma)
            m_df_34 = transDrift(self.dflist[2], self.gamma)

            self.transM = reduce(np.dot, [m_rb_1, m_df_12, m_rb_2, m_df_23, m_rb_3, m_df_34, m_rb_4])

            return self.transM
24973
public INDArray asMatrix(InputStream inputStream) throws IOException {
        if (channels == 3)
            return toBgr(inputStream);
        try {
            BufferedImage image = ImageIO.read(inputStream);
            return asMatrix(image);
        } catch (IOException e) {
            throw new IOException("Unable to load image", e);
        }
    }
1274883
def tril(A):
    
    if isinstance(A,spmatrix):
        idx = [i for i,ij in enumerate(zip(A.I,A.J)) if ij[0]>=ij[1]]
        return spmatrix(A.V[idx],A.I[idx],A.J[idx],A.size)
    elif isinstance(A,matrix):
        B = matrix(0.0, A.size)
        lapack.lacpy(A, B, uplo = 'L')
        return B
    else:
        raise TypeError
1100351
public INDArray asMatrix(BufferedImage image) {
        if (channels == 3) {
            return toBgr(image);
        } else {
            image = scalingIfNeed(image, true);
            int w = image.getWidth();
            int h = image.getHeight();
            INDArray ret = Nd4j.create(h, w);

            for (int i = 0; i < h; i++) {
                for (int j = 0; j < w; j++) {
                    ret.putScalar(new int[]{i, j}, image.getRGB(j, i));
                }
            }
            return ret;
        }
    }
472555
static int glhInvertMatrixf2(float[] m, float[] out) {
        float[][] wtmp = new float[4][8];
        float m0, m1, m2, m3, s;
        float[] r0, r1, r2, r3;
        r0 = wtmp[0];
        r1 = wtmp[1];
        r2 = wtmp[2];
        r3 = wtmp[3];
        r0[0] = MAT(m, 0, 0);
        r0[1] = MAT(m, 0, 1);
        r0[2] = MAT(m, 0, 2);
        r0[3] = MAT(m, 0, 3);
        r0[4] = 1.0f;
        r0[5] = r0[6] = r0[7] = 0.0f;
        r1[0] = MAT(m, 1, 0);
        r1[1] = MAT(m, 1, 1);
        r1[2] = MAT(m, 1, 2);
        r1[3] = MAT(m, 1, 3);
        r1[5] = 1.0f;
        r1[4] = r1[6] = r1[7] = 0.0f;
        r2[0] = MAT(m, 2, 0);
        r2[1] = MAT(m, 2, 1);
        r2[2] = MAT(m, 2, 2);
        r2[3] = MAT(m, 2, 3);
        r2[6] = 1.0f;
        r2[4] = r2[5] = r2[7] = 0.0f;
        r3[0] = MAT(m, 3, 0);
        r3[1] = MAT(m, 3, 1);
        r3[2] = MAT(m, 3, 2);
        r3[3] = MAT(m, 3, 3);
        r3[7] = 1.0f;
        r3[4] = r3[5] = r3[6] = 0.0f;
        /* choose pivot - or die */
        if (Math.abs(r3[0]) > Math.abs(r2[0])) {
            float[] r = r2;
            r2 = r3;
            r3 = r;
        }
        if (Math.abs(r2[0]) > Math.abs(r1[0])) {
            float[] r = r2;
            r2 = r1;
            r1 = r;
        }
        if (Math.abs(r1[0]) > Math.abs(r0[0])) {
            float[] r = r1;
            r1 = r0;
            r0 = r;
        }
        if (0.0 == r0[0])
            return 0;
        /* eliminate first variable */
        m1 = r1[0] / r0[0];
        m2 = r2[0] / r0[0];
        m3 = r3[0] / r0[0];
        s = r0[1];
        r1[1] -= m1 * s;
        r2[1] -= m2 * s;
        r3[1] -= m3 * s;
        s = r0[2];
        r1[2] -= m1 * s;
        r2[2] -= m2 * s;
        r3[2] -= m3 * s;
        s = r0[3];
        r1[3] -= m1 * s;
        r2[3] -= m2 * s;
        r3[3] -= m3 * s;
        s = r0[4];
        if (s != 0.0) {
            r1[4] -= m1 * s;
            r2[4] -= m2 * s;
            r3[4] -= m3 * s;
        }
        s = r0[5];
        if (s != 0.0) {
            r1[5] -= m1 * s;
            r2[5] -= m2 * s;
            r3[5] -= m3 * s;
        }
        s = r0[6];
        if (s != 0.0) {
            r1[6] -= m1 * s;
            r2[6] -= m2 * s;
            r3[6] -= m3 * s;
        }
        s = r0[7];
        if (s != 0.0) {
            r1[7] -= m1 * s;
            r2[7] -= m2 * s;
            r3[7] -= m3 * s;
        }
        /* choose pivot - or die */
        if (Math.abs(r3[1]) > Math.abs(r2[1])) {
            float[] r = r2;
            r2 = r3;
            r3 = r;
        }
        if (Math.abs(r2[1]) > Math.abs(r1[1])) {
            float[] r = r2;
            r2 = r1;
            r1 = r;
        }
        if (0.0 == r1[1])
            return 0;
        /* eliminate second variable */
        m2 = r2[1] / r1[1];
        m3 = r3[1] / r1[1];
        r2[2] -= m2 * r1[2];
        r3[2] -= m3 * r1[2];
        r2[3] -= m2 * r1[3];
        r3[3] -= m3 * r1[3];
        s = r1[4];
        if (0.0 != s) {
            r2[4] -= m2 * s;
            r3[4] -= m3 * s;
        }
        s = r1[5];
        if (0.0 != s) {
            r2[5] -= m2 * s;
            r3[5] -= m3 * s;
        }
        s = r1[6];
        if (0.0 != s) {
            r2[6] -= m2 * s;
            r3[6] -= m3 * s;
        }
        s = r1[7];
        if (0.0 != s) {
            r2[7] -= m2 * s;
            r3[7] -= m3 * s;
        }
        /* choose pivot - or die */
        if (Math.abs(r3[2]) > Math.abs(r2[2])) {
            float[] r = r2;
            r2 = r3;
            r3 = r;
        }
        if (0.0 == r2[2])
            return 0;
        /* eliminate third variable */
        m3 = r3[2] / r2[2];
        r3[3] -= m3 * r2[3];
        r3[4] -= m3 * r2[4];
        r3[5] -= m3 * r2[5];
        r3[6] -= m3 * r2[6];
        r3[7] -= m3 * r2[7];
        /* last check */
        if (0.0 == r3[3])
            return 0;
        s = 1.0f / r3[3]; /* now back substitute row 3 */
        r3[4] *= s;
        r3[5] *= s;
        r3[6] *= s;
        r3[7] *= s;
        m2 = r2[3]; /* now back substitute row 2 */
        s = 1.0f / r2[2];
        r2[4] = s * (r2[4] - r3[4] * m2);
        r2[5] = s * (r2[5] - r3[5] * m2);
        r2[6] = s * (r2[6] - r3[6] * m2);
        r2[7] = s * (r2[7] - r3[7] * m2);
        m1 = r1[3];
        r1[4] -= r3[4] * m1;
        r1[5] -= r3[5] * m1;
        r1[6] -= r3[6] * m1;
        r1[7] -= r3[7] * m1;
        m0 = r0[3];
        r0[4] -= r3[4] * m0;
        r0[5] -= r3[5] * m0;
        r0[6] -= r3[6] * m0;
        r0[7] -= r3[7] * m0;
        m1 = r1[2]; /* now back substitute row 1 */
        s = 1.0f / r1[1];
        r1[4] = s * (r1[4] - r2[4] * m1);
        r1[5] = s * (r1[5] - r2[5] * m1);
        r1[6] = s * (r1[6] - r2[6] * m1);
        r1[7] = s * (r1[7] - r2[7] * m1);
        m0 = r0[2];
        r0[4] -= r2[4] * m0;
        r0[5] -= r2[5] * m0;
        r0[6] -= r2[6] * m0;
        r0[7] -= r2[7] * m0;
        m0 = r0[1]; /* now back substitute row 0 */
        s = 1.0f / r0[0];
        r0[4] = s * (r0[4] - r1[4] * m0);
        r0[5] = s * (r0[5] - r1[5] * m0);
        r0[6] = s * (r0[6] - r1[6] * m0);
        r0[7] = s * (r0[7] - r1[7] * m0);
        MAT(out, 0, 0, r0[4]);
        MAT(out, 0, 1, r0[5]);
        MAT(out, 0, 2, r0[6]);
        MAT(out, 0, 3, r0[7]);
        MAT(out, 1, 0, r1[4]);
        MAT(out, 1, 1, r1[5]);
        MAT(out, 1, 2, r1[6]);
        MAT(out, 1, 3, r1[7]);
        MAT(out, 2, 0, r2[4]);
        MAT(out, 2, 1, r2[5]);
        MAT(out, 2, 2, r2[6]);
        MAT(out, 2, 3, r2[7]);
        MAT(out, 3, 0, r3[4]);
        MAT(out, 3, 1, r3[5]);
        MAT(out, 3, 2, r3[6]);
        MAT(out, 3, 3, r3[7]);
        return 1;
    }
37868
public DenseMatrix getR() {
        int n = qr.ncols();
        DenseMatrix R = Matrix.zeros(n, n);
        for (int i = 0; i < n; i++) {
            R.set(i, i, tau[i]);
            for (int j = i+1; j < n; j++) {
                R.set(i, j, qr.get(i, j));
            }
        }
        return R;
    }
895786
public static DenseMatrix matrix(double[][] A) {
        if (nlmatrixZeros != null) {
            try {
                return (DenseMatrix) nlmatrixArray2D.newInstance((Object) A);
            } catch (Exception e) {
                logger.error("Failed to call NLMatrix(double[][]): {}", e);
            }
        }

        return new JMatrix(A);
    }
34314
public static DoubleMatrix asini(DoubleMatrix x) { 
		/*# mapfct('Math.asin') #*/
//RJPP-BEGIN------------------------------------------------------------
	   for (int i = 0; i < x.length; i++)
	      x.put(i, (double) Math.asin(x.get(i)));
	   return x;
//RJPP-END--------------------------------------------------------------
	}
366630
public static Matrix3d getRotationMatrix(Matrix4d transform) {

		Matrix3d rot = new Matrix3d();
		transform.setRotationScale(rot);
		return rot;
	}
214126
public Matrix4d transfToOrthonormal(Matrix4d m) {
		Vector3d trans = new Vector3d(m.m03,m.m13,m.m23);
		transfToOrthonormal(trans);

		Matrix3d rot = new Matrix3d();
		m.getRotationScale(rot);
		// see Giacovazzo section 2.E, eq. 2.E.1
		// Rprime = MT-1 * R * MT
		rot.mul(this.getMTranspose());
		rot.mul(this.getMTransposeInv(),rot);

		return new Matrix4d(rot,trans,1.0);
	}
1073488
public void getImageRelativeToViewAbsoluteTransform(Matrix outMatrix) {
    outMatrix.setRectToRect(IDENTITY_RECT, mTransformedImageBounds, Matrix.ScaleToFit.FILL);
  }
743454
def getProjectionMatrix(self, eEye, fNearZ, fFarZ):
        """"""

        fn = self.function_table.getProjectionMatrix
        result = fn(eEye, fNearZ, fFarZ)
        return result
11171
def affine_mat(self)->AffineMatrix:
        ""
        if self._affine_mat is None:
            self._affine_mat = torch.eye(3).to(self.device)
        return self._affine_mat
1145612
def rotMatrix2AxisAndAngle(R):
    
    angle = np.arccos((R[0, 0] + R[1, 1] + R[2, 2] - 1)/ 2)
    axis = np.array([
        # x
        (R[2, 1] - R[1, 2])/ np.sqrt((R[2, 1] - R[1, 2])
                                                ** 2 + (R[0, 2] - R[2, 0])**2 + (R[1, 0] - R[0, 1])**2),
        # y
        (R[0, 2] - R[2, 0])/ np.sqrt((R[2, 1] - R[1, 2])
                                                ** 2 + (R[0, 2] - R[2, 0])**2 + (R[1, 0] - R[0, 1])**2),
        # z
        (R[1, 0] - R[0, 1])/ np.sqrt((R[2, 1] - R[1, 2])**2 + 
                                                (R[0, 2] - R[2, 0])**2 + (R[1, 0] - R[0, 1])**2)])
    return axis, angle
842476
private RectF getDisplayRect(Matrix matrix) {
        ImageView imageView = getImageView();

        if (null != imageView) {
            Drawable d = imageView.getDrawable();
            if (null != d) {
                mDisplayRect.set(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
                matrix.mapRect(mDisplayRect);
                return mDisplayRect;
            }
        }
        return null;
    }
636940
public Matrix4f getOffsetMatrix()
    {
        Matrix4f offsetMatrix = new Matrix4f();
        offsetMatrix.set(NativeBone.getOffsetMatrix(getNative()));
        return offsetMatrix;
    }