org.apache.mahout.math.hadoop.stochasticsvd
Class SSVDHelper

java.lang.Object
  extended by org.apache.mahout.math.hadoop.stochasticsvd.SSVDHelper

public class SSVDHelper
extends Object

set of small file manipulation helpers.


Constructor Summary
SSVDHelper()
           
 
Method Summary
static double[][] extractRawData(Matrix m)
          extracts row-wise raw data from a Mahout matrix for 3rd party solvers.
static UpperTriangular loadAndSumUpperTriangularMatrices(org.apache.hadoop.fs.Path glob, org.apache.hadoop.conf.Configuration conf)
          Load multiplel upper triangular matrices and sum them up.
static Vector loadAndSumUpVectors(org.apache.hadoop.fs.Path glob, org.apache.hadoop.conf.Configuration conf)
          returns sum of all vectors in different files specified by glob
static double[][] loadDistributedRowMatrix(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path glob, org.apache.hadoop.conf.Configuration conf)
          helper capabiltiy to load distributed row matrices into dense matrix (to support tests mainly).
static UpperTriangular loadUpperTriangularMatrix(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path glob, org.apache.hadoop.conf.Configuration conf)
          Load only one upper triangular matrix and issue error if mroe than one is found.
static void saveVector(Vector v, org.apache.hadoop.fs.Path vectorFilePath, org.apache.hadoop.conf.Configuration conf)
          save single vector into hdfs file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SSVDHelper

public SSVDHelper()
Method Detail

saveVector

public static void saveVector(Vector v,
                              org.apache.hadoop.fs.Path vectorFilePath,
                              org.apache.hadoop.conf.Configuration conf)
                       throws IOException
save single vector into hdfs file.

Parameters:
v - vector to save
vectorFilePath -
conf -
Throws:
IOException

loadDistributedRowMatrix

public static double[][] loadDistributedRowMatrix(org.apache.hadoop.fs.FileSystem fs,
                                                  org.apache.hadoop.fs.Path glob,
                                                  org.apache.hadoop.conf.Configuration conf)
                                           throws IOException
helper capabiltiy to load distributed row matrices into dense matrix (to support tests mainly).

Parameters:
fs - filesystem
glob - FS glob
conf - configuration
Returns:
Dense matrix array
Throws:
IOException - when I/O occurs.

loadAndSumUpperTriangularMatrices

public static UpperTriangular loadAndSumUpperTriangularMatrices(org.apache.hadoop.fs.Path glob,
                                                                org.apache.hadoop.conf.Configuration conf)
                                                         throws IOException
Load multiplel upper triangular matrices and sum them up.

Parameters:
fs -
glob -
conf -
Returns:
the sum of upper triangular inputs.
Throws:
IOException

loadAndSumUpVectors

public static Vector loadAndSumUpVectors(org.apache.hadoop.fs.Path glob,
                                         org.apache.hadoop.conf.Configuration conf)
                                  throws IOException
returns sum of all vectors in different files specified by glob

Parameters:
glob -
conf -
Returns:
Throws:
IOException

loadUpperTriangularMatrix

public static UpperTriangular loadUpperTriangularMatrix(org.apache.hadoop.fs.FileSystem fs,
                                                        org.apache.hadoop.fs.Path glob,
                                                        org.apache.hadoop.conf.Configuration conf)
                                                 throws IOException
Load only one upper triangular matrix and issue error if mroe than one is found.

Parameters:
fs -
glob -
conf -
Returns:
Throws:
IOException

extractRawData

public static double[][] extractRawData(Matrix m)
extracts row-wise raw data from a Mahout matrix for 3rd party solvers. Unfortunately values member is 100% encapsulated in DenseMatrix at this point, so we have to resort to abstract element-wise copying.

Parameters:
m -
Returns:


Copyright © 2008-2012 The Apache Software Foundation. All Rights Reserved.