C = compressed-column form of a triplet matrix T. The columns of C are
not sorted, and duplicate entries may be present in C.

@param T
triplet matrix
@return C if successful, null on error
333107
public static Scs cs_compress(Scs T) {
        int m, n, nz, p, k, Cp[], Ci[], w[], Ti[], Tj[];
        float Cx[], Tx[];
        Scs C;
        if (!Scs_util.CS_TRIPLET(T))
            return (null); /* check inputs */
        m = T.m;
        n = T.n;
        Ti = T.i;
        Tj = T.p;
        Tx = T.x;
        nz = T.nz;
        C = Scs_util.cs_spalloc(m, n, nz, Tx != null, false); /* allocate result */
        w = new int[n]; /* get workspace */
        Cp = C.p;
        Ci = C.i;
        Cx = C.x;
        for (k = 0; k < nz; k++)
            w[Tj[k]]++; /* column counts */
        Scs_cumsum.cs_cumsum(Cp, w, n); /* column pointers */
        for (k = 0; k < nz; k++) {
            Ci[p = w[Tj[k]]++] = Ti[k]; /* A(i,j) is the pth entry in C */
            if (Cx != null)
                Cx[p] = Tx[k];
        }
        return C;
    }
513538
public Matrix multiply(double c)
    {
        Matrix toReturn = getThisSideMatrix(null);
        toReturn.mutableMultiply(c);
        return toReturn;
    }
589524
private static BitMatrix matrixFromString(String uri, int width, int height) {
        Writer qrWriter = new QRCodeWriter();
        BitMatrix matrix;
        try {
            matrix = qrWriter.encode(uri, BarcodeFormat.QR_CODE, width, height);
        } catch (WriterException e) {
            throw new RuntimeException(e);
        }
        return matrix;
    }
699030
public static ColumnMajorSparseMatrix block(Matrix a, Matrix b, Matrix c, Matrix d) {
        return CCSMatrix.block(a, b, c, d);
    }
816009
public static <T extends Comparable<? super T>> T min(final T[] a) {
        N.checkArgNotNullOrEmpty(a, "The spcified array 'a' can not be null or empty");

        return min(a, 0, a.length);
    }
1178250
public static void matrixCopy(Object[][] src, Object[][] dest) {
        if (src != null && dest != null) {
            for (int i = 0; i < src.length; i++) {
                System.arraycopy(src[i], 0, dest[i], 0, src[i].length);
            }
        }
    }
1126955
public DenseMatrix nullspace() {
        if (!full) {
            throw new IllegalStateException("This is not a FULL singular value decomposition.");
        }

        int nn = 0;
        DenseMatrix nullsp = Matrix.zeros(n, nullity());
        for (int j = 0; j < n; j++) {
            if (s[j] <= tol) {
                for (int jj = 0; jj < n; jj++) {
                    nullsp.set(jj, nn, V.get(jj, j));
                }
                nn++;
            }
        }
        return nullsp;
    }
602332
@Override
    public ZMatrixRMaj getQ(ZMatrixRMaj Q , boolean compact ) {
        if( compact )
            Q = UtilDecompositons_ZDRM.checkIdentity(Q,numRows,minLength);
        else
            Q = UtilDecompositons_ZDRM.checkIdentity(Q,numRows,numRows);

        for( int j = minLength-1; j >= 0; j-- ) {
            QrHelperFunctions_ZDRM.extractHouseholderColumn(QR,j,numRows,j,u,0);
            QrHelperFunctions_ZDRM.rank1UpdateMultR(Q,u,0,gammas[j],j,j,numRows,v);
        }

        return Q;
    }
1000194
public DenseDoubleMatrix multT(DoubleMatrix bMat, boolean transposeA, boolean transposeB) {
        int numRowsC = transposeA ? this.getNumColumns() : this.getNumRows();
        int numColsC = transposeB ? bMat.getNumRows() : bMat.getNumColumns();
        DenseDoubleMatrix cMat = new DenseDoubleMatrix(numRowsC, numColsC);
        this.multT(bMat, cMat, transposeA, transposeB);
        return cMat;
    }
434982
public long[] transposeShapeArray(long[] shape) {
        if (shape.length == 2) {
            return ArrayUtil.reverseCopy(shape);
        } else if (shape.length == 3) {
            return new long[] {shape[0], shape[2], shape[1]};
        } else {
            throw new IllegalArgumentException("Matrix input has to be of length 2 or 3, got: " + shape.length );
        }

    }
971818
private int at(long t) {
        SortedMap<Long, int[]> head = data.subMap(t,Long.MAX_VALUE);
        if (head.isEmpty()) return 0;
        return data.get(head.firstKey())[0];
    }
834912
public static byte[] decode(final byte[] compressed) throws IOException {
        ByteArrayInputStream byteIn = new ByteArrayInputStream(compressed);
        ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
        GZIPInputStream gzIn = null;
        try {
            gzIn = new GZIPInputStream(byteIn);
            int read;
            byte[] buffer = new byte[BUFFER_SIZE];
            do {
                read = gzIn.read(buffer);
                if (read > 0) {
                    byteOut.write(buffer, 0, read);
                }
            } while (read >= 0);
            return byteOut.toByteArray();
        } finally {
            gzIn.close();
            byteOut.close();
        }
    }
1274238
public T transpose() {
        T ret = createMatrix(mat.getNumCols(),mat.getNumRows(), mat.getType());

        ops.transpose(mat,ret.mat);

        return ret;
    }
838500
@Override
    public DMatrixRMaj getR(DMatrixRMaj R, boolean compact) {
        if( R == null ) {
            if( compact ) {
                R = new DMatrixRMaj(minLength,numCols);
            } else
                R = new DMatrixRMaj(numRows,numCols);
        } else {
            if( compact ) {
                R.reshape(minLength,numCols);
            } else {
                R.reshape(numRows,numCols);
            }

            for( int i = 0; i < R.numRows; i++ ) {
                int min = Math.min(i,R.numCols);
                for( int j = 0; j < min; j++ ) {
                    R.unsafe_set(i,j,0);
                }
            }
        }

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


        return R;
    }
594214
public static <T> T[] shrink(T[] from, T[] to)
    {
        assert to.length <= from.length;
        System.arraycopy(from, 0, to, 0, to.length);
        return to;
    }
1275443
public static Double[] getColumnDoubleValues(CSTable t, String columnName) {
        int col = columnIndex(t, columnName);
        if (col == -1) {
            throw new IllegalArgumentException("No such column: " + columnName);
        }
        List<Double> l = new ArrayList<Double>();
        for (String[] s : t.rows()) {
            l.add(new Double(s[col]));
        }
        return l.toArray(new Double[0]);
    }
1260555
public TreeModel.CompressedTree compress() {
//    Log.info(Sys.RANDF, _tree.toString(new StringBuilder(), Integer.MAX_VALUE).toString());
    int size = _tree.dtreeSize();
    if (_tree instanceof LeafNode) {
      size += 3;
    }
    AutoBuffer ab = new AutoBuffer(size);
    if( _tree instanceof LeafNode)
      ab.put1(0).put2((char)65535);
    _tree.compress(ab);
    assert ab.position() == size: "Actual size doesn't agree calculated size.";
    char _nclass = (char)_data.classes();
    return new TreeModel.CompressedTree(ab.buf(),_nclass,_seed);
  }