## org.apache.mahout.math.hadoop.solver
Class DistributedConjugateGradientSolver

    java.lang.Object
      org.apache.mahout.math.solver.ConjugateGradientSolver
          org.apache.mahout.math.hadoop.solver.DistributedConjugateGradientSolver

All Implemented Interfaces:
  org.apache.hadoop.conf.Configurable, org.apache.hadoop.util.Tool

    public class DistributedConjugateGradientSolver

extends ConjugateGradientSolver
implements org.apache.hadoop.util.Tool

Distributed implementation of the conjugate gradient solver. More or less, this is just the standard solver but wrapped with some methods that make it easy to run it on a DistributedRowMatrix.

Nested Class Summary
`class` `DistributedConjugateGradientSolver.DistributedConjugateGradientSolverJob`

Field Summary

Fields inherited from class org.apache.mahout.math.solver.ConjugateGradientSolver
`DEFAULT_MAX_ERROR`

Constructor Summary
`DistributedConjugateGradientSolver()`

Method Summary
`org.apache.hadoop.conf.Configuration` `getConf()`
`DistributedConjugateGradientSolver.DistributedConjugateGradientSolverJob` `job()`
`static void` `main(String[] args)`
`int` `run(String[] strings)`
`Vector` `runJob(org.apache.hadoop.fs.Path inputPath, org.apache.hadoop.fs.Path tempPath, int numRows, int numCols, Vector b, Preconditioner preconditioner, int maxIterations, double maxError)` Runs the distributed conjugate gradient solver programmatically to solve the system (A + lambda*I)x = b.
`void` `setConf(org.apache.hadoop.conf.Configuration conf)`

Methods inherited from class org.apache.mahout.math.solver.ConjugateGradientSolver
`getIterations, getResidualNorm, solve, solve, solve`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DistributedConjugateGradientSolver

    public DistributedConjugateGradientSolver()

Method Detail

### runJob

    public Vector runJob(org.apache.hadoop.fs.Path inputPath,
                         org.apache.hadoop.fs.Path tempPath,
                         int numRows,
                         int numCols,
                         Vector b,
                         Preconditioner preconditioner,
                         int maxIterations,
                         double maxError)

  Runs the distributed conjugate gradient solver programmatically to solve the system (A + lambda*I)x = b.

  Parameters:
    `inputPath` - Path to the matrix A
    `tempPath` - Path to scratch output path, deleted after the solver completes
    `numRows` - Number of rows in A
    `numCols` - Number of columns in A
    `b` - Vector b
    `preconditioner` - Optional preconditioner for the system
    `maxIterations` - Maximum number of iterations to run, defaults to numCols
    `maxError` - Maximum error tolerated in the result. If the norm of the residual falls below this, then the algorithm stops and returns.
  Returns:
    The vector that solves the system.

### getConf

    public org.apache.hadoop.conf.Configuration getConf()

  Specified by:
    `getConf` in interface `org.apache.hadoop.conf.Configurable`

### setConf

    public void setConf(org.apache.hadoop.conf.Configuration conf)

  Specified by:
    `setConf` in interface `org.apache.hadoop.conf.Configurable`

### run

    public int run(String[] strings)
            throws Exception

  Specified by:
    `run` in interface `org.apache.hadoop.util.Tool`
  Throws:
    `Exception`

### job

    public DistributedConjugateGradientSolver.DistributedConjugateGradientSolverJob job()

### main

    public static void main(String[] args)
                     throws Exception

  Throws:
    `Exception`

Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.