Extracts the tridiagonal matrix found in the decomposition.

@param T If not null then the results will be stored here.  Otherwise a new matrix will be created.
@return The extracted T matrix.
164320
@Override
    public ZMatrixRMaj getT(ZMatrixRMaj T ) {
        T = UtilDecompositons_ZDRM.checkZeros(T,N,N);

        T.data[0] = QT.data[0];
        T.data[1] = QT.data[1];

        for( int i = 1; i < N; i++ ) {
            T.set(i,i, QT.getReal(i,i), QT.getImag(i,i));
            double real = QT.getReal(i-1,i);
            double imag = QT.getImag(i-1,i);
            T.set(i-1,i,real,imag);
            T.set(i,i-1,real,-imag);
        }

        return T;
    }
634333
public static DMatrix2 extractColumn( DMatrix2x2 a , int column , DMatrix2 out ) {
        if( out == null) out = new DMatrix2();
        switch( column ) {
            case 0:
                out.a1 = a.a11;
                out.a2 = a.a21;
            break;
            case 1:
                out.a1 = a.a12;
                out.a2 = a.a22;
            break;
            default:
                throw new IllegalArgumentException("Out of bounds column.  column = "+column);
        }
        return out;
    }
523358
def matrix(self, title=None):
        
        if title is None:
            return javabridge.call(self.jobject, "toMatrixString", "()Ljava/lang/String;")
        else:
            return javabridge.call(self.jobject, "toMatrixString", "(Ljava/lang/String;)Ljava/lang/String;", title)
864407
public static INDArray toMatrix(Matrix arr) {

        // we assume that Matrix always has F order
        return Nd4j.create(arr.toArray(), new int[] {arr.numRows(), arr.numCols()}, 'f');
    }
1291216
public FloatBuffer getAsMatrix3f(FloatBuffer dest) {
        MemUtil.INSTANCE.putMatrix3f(this, dest.position(), dest);
        return dest;
    }
1307999
public static Array2DRowRealMatrix getRadiusOfGyrationTensor(Trajectory t){
		double meanx =0;
		double meany =0;
		for(int i = 0; i < t.size(); i++){
			meanx+= t.get(i).x;
			meany+= t.get(i).y;
		}
		meanx = meanx/t.size();
		meany = meany/t.size();
		
		double e11 = 0;
		double e12 = 0;
		double e21 = 0;
		double e22 = 0;
		
		for(int i = 0; i < t.size(); i++){
			e11 += Math.pow(t.get(i).x-meanx,2);
			e12 += (t.get(i).x-meanx)*(t.get(i).y-meany);
			e22 += Math.pow(t.get(i).y-meany,2);
		}
		e11 = e11 / t.size();
		e12 = e12 / t.size();
		e21 = e12;
		e22 = e22 / t.size();
		int rows = 2;
		int columns = 2;
		Array2DRowRealMatrix gyr = new Array2DRowRealMatrix(rows, columns); 
		
		gyr.addToEntry(0, 0, e11);
		gyr.addToEntry(0, 1, e12);
		gyr.addToEntry(1, 0, e21);
		gyr.addToEntry(1, 1, e22);
		
		return gyr;
	}
1253438
private static BitMatrix extractPureBits(BitMatrix image) throws NotFoundException {

    int[] enclosingRectangle = image.getEnclosingRectangle();
    if (enclosingRectangle == null) {
      throw NotFoundException.getNotFoundInstance();
    }

    int left = enclosingRectangle[0];
    int top = enclosingRectangle[1];
    int width = enclosingRectangle[2];
    int height = enclosingRectangle[3];

    // Now just read off the bits
    BitMatrix bits = new BitMatrix(MATRIX_WIDTH, MATRIX_HEIGHT);
    for (int y = 0; y < MATRIX_HEIGHT; y++) {
      int iy = top + (y * height + height / 2) / MATRIX_HEIGHT;
      for (int x = 0; x < MATRIX_WIDTH; x++) {
        int ix = left + (x * width + width / 2 + (y & 0x01) *  width / 2) / MATRIX_WIDTH;
        if (image.get(ix, iy)) {
          bits.set(x, y);
        }
      }
    }
    return bits;
  }
616373
public Matrix getR () {
		Matrix X = new Matrix(n,n);
		double[][] R = X.getArray();
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				if (i < j) {
					R[i][j] = QR[i][j];
				} else if (i == j) {
					R[i][j] = Rdiag[i];
				} else {
					R[i][j] = 0.0;
				}
			}
		}
		return X;
	}
1188044
public Matrix transpose()
    {
        final Matrix A = new Matrix(m_columns, m_rows);

        for (int i = 0; i < m_rows; i++)
        {
            for (int j = 0; j < m_columns; j++)
            {
                A.m_data[j][i] = this.m_data[i][j];
            }
        }
        return A;
    }
19991
public Bbox transform(Matrix t) {
		Coordinate c1 = transform(t, new Coordinate(x, y));
		Coordinate c2 = transform(t, new Coordinate(x + width, y + height));
		Coordinate origin = new Coordinate(Math.min(c1.getX(), c2.getX()), Math.min(c1.getY(), c2.getY()));
		Coordinate endPoint = new Coordinate(Math.max(c1.getX(), c2.getX()), Math.max(c1.getY(), c2.getY()));
		return new Bbox(origin.getX(), origin.getY(), endPoint.getX() - origin.getX(), endPoint.getY() - origin.getY());
	}
937483
private Matrix getThisSideMatrix(Matrix B)
    {
        if(this.canBeMutated())
            return this.clone();
        else//so far, only other option in JSAT is a dense matrix
        {
            DenseMatrix dm = new DenseMatrix(rows(), cols());
            dm.mutableAdd(this);
            return dm;
        }
    }
45219
public static double[][] getMatrix(final double[][] m1, final int r0, final int r1, final int[] c) {
    assert r0 <= r1 : ERR_INVALID_RANGE;
    assert r1 <= m1.length : ERR_MATRIX_DIMENSIONS;
    final int rowdim = r1 - r0, coldim = c.length;
    final double[][] X = new double[rowdim][coldim];
    for(int i = r0; i < r1; i++) {
      final double[] row = m1[i];
      final double[] Xi = X[i - r0];
      for(int j = 0; j < coldim; j++) {
        Xi[j] = row[c[j]];
      }
    }
    return X;
  }
920803
public static double[][] getMatrix(final double[][] m1, final int[] r, final int[] c) {
    final int rowdim = r.length, coldim = c.length;
    final double[][] X = new double[rowdim][coldim];
    for(int i = 0; i < rowdim; i++) {
      final double[] rowM = m1[r[i]], rowX = X[i];
      for(int j = 0; j < coldim; j++) {
        rowX[j] = rowM[c[j]];
      }
    }
    return X;
  }
1201380
public <T extends Matrix> T to(MatrixFactory<T> factory) {
        T result = factory.apply(rows, columns);
        apply(LinearAlgebra.IN_PLACE_COPY_MATRIX_TO_MATRIX, result);
        return result;
    }
1361787
@Nonnull
  @ReturnsMutableCopy
  public Matrix getQ ()
  {
    final Matrix aNewMatrix = new Matrix (m_nRows, m_nCols);
    final double [] [] aNewArray = aNewMatrix.internalGetArray ();
    for (int k = m_nCols - 1; k >= 0; k--)
    {
      final double [] aQRk = m_aQR[k];
      for (int nRow = 0; nRow < m_nRows; nRow++)
        aNewArray[nRow][k] = 0.0;
      aNewArray[k][k] = 1.0;
      for (int j = k; j < m_nCols; j++)
      {
        if (aQRk[k] != 0)
        {
          double s = 0.0;
          for (int i = k; i < m_nRows; i++)
            s += m_aQR[i][k] * aNewArray[i][j];
          s = -s / aQRk[k];
          for (int i = k; i < m_nRows; i++)
          {
            aNewArray[i][j] += s * m_aQR[i][k];
          }
        }
      }
    }
    return aNewMatrix;
  }
1046841
function(t, obj) {
            	var V, R = null, x, y, z;
            	if (t.determinant) { R = t.elements; }
            	switch (this.elements.length) {
            	case 2:
                        V = obj.elements || obj;
                        if (V.length != 2) { return null; }
                        if (!R) { R = matrix$2.Rotation(t).elements; }
                        x = this.elements[0] - V[0];
                        y = this.elements[1] - V[1];
                        return Vector.create([
            		V[0] + R[0][0] * x + R[0][1] * y,
            		V[1] + R[1][0] * x + R[1][1] * y
                        ]);
                        break;
            	case 3:
                        if (!obj.direction) { return null; }
                        var C = obj.pointClosestTo(this).elements;
                        if (!R) { R = matrix$2.Rotation(t, obj.direction).elements; }
                        x = this.elements[0] - C[0];
                        y = this.elements[1] - C[1];
                        z = this.elements[2] - C[2];
                        return Vector.create([
            		C[0] + R[0][0] * x + R[0][1] * y + R[0][2] * z,
            		C[1] + R[1][0] * x + R[1][1] * y + R[1][2] * z,
            		C[2] + R[2][0] * x + R[2][1] * y + R[2][2] * z
                        ]);
                        break;
            	default:
                        return null;
            	}
                }
1298571
public DMatrixRMaj getR() {
        DMatrixRMaj R = new DMatrixRMaj(QR.numRows,QR.numCols);
        int N = Math.min(QR.numCols,QR.numRows);

        for( int i = 0; i < N; i++ ) {
            for( int j = i; j < QR.numCols; j++ ) {
                R.unsafe_set(i,j, QR.unsafe_get(i,j));
            }
        }

        return R;
    }