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);