Prints a sparse matrix.

@param A
sparse matrix (triplet ot column-compressed)
@param brief
print all of A if false, a few entries otherwise
@return true if successful, false on error
964119
public static boolean cs_print(Scs A, boolean brief) {
        int p, j, m, n, nzmax, nz, Ap[], Ai[];
        float Ax[];
        if (A == null) {
            System.out.print("(null)\n");
            return (false);
        }
        m = A.m;
        n = A.n;
        Ap = A.p;
        Ai = A.i;
        Ax = A.x;
        nzmax = A.nzmax;
        nz = A.nz;
        System.out.print(String.format("CSparseJ Version %d.%d.%d, %s.  %s\n", Scs_common.CS_VER, Scs_common.CS_SUBVER,
                Scs_common.CS_SUBSUB, Scs_common.CS_SATE, Scs_common.CS_COPYRIGHT));
        if (nz < 0) {
            System.out.print(String.format("%d-by-%d, nzmax: %d nnz: %d, 1-norm: %g\n", m, n, nzmax, Ap[n], Scs_norm
                    .cs_norm(A)));
            for (j = 0; j < n; j++) {
                System.out.print(String.format("    col %d : locations %d to %d\n", j, Ap[j], Ap[j + 1] - 1));
                for (p = Ap[j]; p < Ap[j + 1]; p++) {
                    System.out.print(String.format("      %d : %g\n", Ai[p], Ax != null ? Ax[p] : 1));
                    if (brief && p > 20) {
                        System.out.print("  ...\n");
                        return (true);
                    }
                }
            }
        } else {
            System.out.print(String.format("triplet: %d-by-%d, nzmax: %d nnz: %d\n", m, n, nzmax, nz));
            for (p = 0; p < nz; p++) {
                System.out.print(String.format("    %d %d : %g\n", Ai[p], Ap[p], Ax != null ? Ax[p] : 1));
                if (brief && p > 20) {
                    System.out.print("  ...\n");
                    return (true);
                }
            }
        }
        return (true);
    }
51278
def is_sparse_file(filename):
    
    dirname, basename = os.path.split(filename)
    name, ext = os.path.splitext(basename)
    matrix_name, matrix_ext = os.path.splitext(name)
    if matrix_ext == '.coo':
        return True
    else:
        return False
1362192
def print(*a):
    
    try:
        _print(*a)
        return a[0] if len(a) == 1 else a
    except:
        _print(*a)
255407
public static void printMatrix(byte[][] matrix, int maxX, int maxY, PrintStream stream) {
		for(int i = 0; i < maxX; i++) {
			for(int j = 0; j < maxY; j++) {
				stream.print(matrix[i][j] + " ");
			}
			stream.print("\n");
		}
		stream.println();
	}
1164752
public static SparseMatrix block(Matrix a, Matrix b, Matrix c, Matrix d) {
        return CRSMatrix.block(a, b, c, d);
    }
995579
@Override
    public DMatrixRMaj getQ(DMatrixRMaj Q , boolean compact ) {
        if( compact ) {
            if( Q == null ) {
                Q = CommonOps_DDRM.identity(numRows,minLength);
            } else {
                if( Q.numRows != numRows || Q.numCols != minLength ) {
                    throw new IllegalArgumentException("Unexpected matrix dimension.");
                } else {
                    CommonOps_DDRM.setIdentity(Q);
                }
            }
        } else {
            if( Q == null ) {
                Q = CommonOps_DDRM.identity(numRows);
            } else {
                if( Q.numRows != numRows || Q.numCols != numRows ) {
                    throw new IllegalArgumentException("Unexpected matrix dimension.");
                } else {
                    CommonOps_DDRM.setIdentity(Q);
                }
            }
        }

        // Unlike applyQ() this takes advantage of zeros in the identity matrix
        // by not multiplying across all rows.
        for( int j = minLength-1; j >= 0; j-- ) {
            int diagIndex = j*numRows+j;
            double before = QR.data[diagIndex];
            QR.data[diagIndex] = 1;
            QrHelperFunctions_DDRM.rank1UpdateMultR(Q, QR.data, j * numRows, gammas[j], j, j, numRows, v);
            QR.data[diagIndex] = before;
        }

        return Q;
    }
783628
public static boolean isDiagonalPositive( DMatrixRMaj a ) {
        for( int i = 0; i < a.numRows; i++ ) {
            if( !(a.get(i,i) >= 0) )
                return false;
        }
        return true;
    }
976668
protected void commonSetup(ZMatrixRMaj A) {
        setExpectedMaxSize(A.numRows,A.numCols);

        QR.set(A);
    }
1067568
private boolean process(DMatrixRMaj A) {
		if( !solverNull.process(A,2,nullspace) )
			return false;

		SpecializedOps_DDRM.subvector(nullspace, 0, 0, 9, false, 0, F1);
		SpecializedOps_DDRM.subvector(nullspace, 0, 1, 9, false, 0, F2);

		return true;
	}
147386
protected void commonSetup(DMatrixRMaj A) {
        setExpectedMaxSize(A.numRows,A.numCols);

        QR.set(A);
    }
25068
@Override
    public void print(char c) throws IOException {
	boolean isWS = Character.isWhitespace(c);
	if (isWS) {
	    if (isFirstChar) // ignore all WS before non-WS content
		return;
	    if (c == CHAR_RETURN) // ignore Carriage-Return chars
		return;
	    if (sb.length() > 0) {
		printBuffer(); // buffer should never contain WS so flush it
		lastChar = (c == CHAR_NL) ? CHAR_NL : c;
		super.print(lastChar);
		return;
	    }
	}

	isFirstChar = false;
	if (c == CHAR_GT && sb.length() > 0) printBuffer(); // buffer should never contain ">" so flush it

	if (isWS || !addToBuffer(c)) {
	    if (depthSum == 0) { // we're not in a WS-preserving tag; suppress whitespace
		if (isWS) { // this char is WS
		    if (lastChar == CHAR_NL) // lastChar was NL; discard this WS char
			return;
		    if (c != CHAR_NL) { // this WS char is not NL
			if (Character.isWhitespace(lastChar)) return; // lastChar was WS but Not NL; discard this WS char
		    }
		}
	    }
	    lastChar = c; // remember c as lastChar and write it to output stream
	    super.print(c);
	}
    }
1191546
def print_matrix(self, format=None, output=sys.stdout, depth=0, **kwargs):
        
        matrix = self.as_matrix(depth=depth)
        matrix.print(format=format, output=output, **kwargs)
1123424
@Override
    public boolean decompose(DMatrixRBlock A) {
        if( A.numCols != A.numRows )
            throw new IllegalArgumentException("A must be square");

        this.T = A;

        if( lower )
            return decomposeLower();
        else
            return decomposeUpper();
    }
145130
public static boolean cs_print(DZcs A, boolean brief, OutputStream output)
	{
		int p, j, m, n, nzmax, nz, Ap[], Ai[] ;
		DZcsa Ax = new DZcsa() ;
		PrintStream out = new PrintStream(output);
		if (A == null)
		{
		    out.print("(null)\n") ;
		    return (false) ;
		}
		m = A.m ; n = A.n ; Ap = A.p ; Ai = A.i ; Ax.x = A.x ;
		nzmax = A.nzmax ; nz = A.nz ;
		/*out.printf("CXSparseJ Version %d.%d.%d, %s.  %s\n",
			DZcs_common.CS_VER, DZcs_common.CS_SUBVER, DZcs_common.CS_SUBSUB,
			DZcs_common.CS_DATE, DZcs_common.CS_COPYRIGHT) ;*/
		if (nz < 0)
		{
			out.printf("%d-by-%d, nzmax: %d nnz: %d, 1-norm: %g\n", m, n,
				nzmax, Ap[n], cs_norm (A)) ;
			for (j = 0 ; j < n ; j++)
			{
				out.printf("    col %d : locations %d to %d\n",
					j, Ap [j], Ap [j+1] - 1) ;
				for (p = Ap [j] ; p < Ap [j+1] ; p++)
				{
					out.printf("      %d : (%g, %g)\n", Ai [p],
						Ax.x != null ? cs_creal (Ax.get(p)) : 1,
						Ax.x != null ? cs_cimag (Ax.get(p)) : 0) ;
					if (brief && p > 20)
					{
						out.print("  ...\n") ;
						return (true) ;
					}
				}
			}
		}
		else
		{
			out.printf("triplet: %d-by-%d, nzmax: %d nnz: %d\n",
				m, n, nzmax, nz) ;
			for (p = 0 ; p < nz ; p++)
			{
				out.printf("    %d %d : (%g, %g)\n", Ai [p], Ap [p],
					Ax.x != null ? cs_creal (Ax.get(p)) : 1,
					Ax.x != null ? cs_cimag (Ax.get(p)) : 0) ;
				if (brief && p > 20)
				{
					out.print("  ...\n") ;
					return (true) ;
				}
			}
		}
		return (true) ;
	}
110492
public static boolean isSameStructure(DMatrixSparseCSC a , DMatrixSparseCSC b) {
        if( a.numRows == b.numRows && a.numCols == b.numCols && a.nz_length == b.nz_length) {
            for (int i = 0; i <= a.numCols; i++) {
                if( a.col_idx[i] != b.col_idx[i] )
                    return false;
            }
            for (int i = 0; i < a.nz_length; i++) {
                if( a.nz_rows[i] != b.nz_rows[i] )
                    return false;
            }
            return true;
        }
        return false;
    }
1160162
public static void print(String name, List<?> list) {
		JK.line();
		print(String.format("List (%s):", name));
		int index = 1;
		for (Object object : list) {
			JK.print(String.format("\t%d) %s", index++, object));
		}
		JK.line();
	}
109927
public static void multCol(Matrix A, int j, double c)
    {
        multCol(A, j, 0, A.rows(), c);
    }