Package edu.ucla.sspace.matrix.MatrixIO

Examples of edu.ucla.sspace.matrix.MatrixIO.Format


        if (algorithm.equals(Algorithm.ANY))
            algorithm = getFastestAvailableAlgorithm();
        if (algorithm == null)
            throw new UnsupportedOperationException(
                "No SVD algorithm is available on this system");
        Format fmt = null;
        switch (algorithm) {
        // In the case of COLT or JAMA, avoid writing the matrix to disk
        // altogether, and just pass it in directly.  This avoids the I/O
        // overhead, althought both methods require that the matrix be converted
        // into arrays first.
View Full Code Here


    public static void checkMatrixTransposed(MatrixBuilder builder, Matrix m) {
        try {
            // Read the matrix back in using the standard matrix io tools.
            File mFile = builder.getFile();
            Format format = builder.getMatrixFormat();
            MatrixFile matrixFile = builder.getMatrixFile();
            assertEquals(mFile, matrixFile.getFile());
            assertEquals(format, matrixFile.getFormat());

            Matrix out = MatrixIO.readMatrix(mFile, format);
View Full Code Here

    public static void checkMatrix(MatrixBuilder builder, Matrix m) {
        try {
            // Read the matrix back in using the standard matrix io tools.
            File mFile = builder.getFile();
            Format format = builder.getMatrixFormat();
            Matrix out = MatrixIO.readMatrix(mFile, format);
            MatrixFile matrixFile = builder.getMatrixFile();
            assertEquals(mFile, matrixFile.getFile());
            assertEquals(format, matrixFile.getFormat());
View Full Code Here

            System.exit(1);
        }

        File inMatFile = new File(options.getPositionalArg(0));
        File outMatFile = new File(options.getPositionalArg(1));
        Format inMatFormat = Format.valueOf(
                options.getStringOption('i').toUpperCase());
        Format outMatFormat = Format.valueOf(
                options.getStringOption('o').toUpperCase());
        Matrix matrix = MatrixIO.readMatrix(inMatFile, inMatFormat);
        MatrixIO.writeMatrix(matrix, outMatFile, outMatFormat);
    }
View Full Code Here

        LoggerUtil.setLevel(Level.FINE);

        int dimensions = options.getIntOption('r');
        MatrixFactorization reducer = null;
        Format format = null;
        if (options.getStringOption('a').equals("NMF")) {
            reducer = new NonNegativeMatrixFactorizationMultiplicative();
            format = Format.MATLAB_SPARSE;
        } else if (options.getStringOption('a').equals("SVD")) {
            reducer = SVD.getFastestAvailableFactorization();
View Full Code Here

        File outputDir = new File(outputDirName);
        if (!outputDir.exists() || !outputDir.isDirectory())
            throw new IllegalArgumentException(
                "invalid output directory: " + outputDirName);

        Format inputFormat = (options.hasOption('r'))
            ? getFormat(options.getStringOption('r'))
            : Format.SVDLIBC_SPARSE_TEXT;
        Format outputFormat = (options.hasOption('w'))
            ? getFormat(options.getStringOption('w'))
            : Format.SVDLIBC_DENSE_TEXT;

        MatrixFactorization factorizer = SVD.getFastestAvailableFactorization();
        factorizer.factorize(new MatrixFile(matrixFile, inputFormat), dimensions);
View Full Code Here

TOP

Related Classes of edu.ucla.sspace.matrix.MatrixIO.Format

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.