Playa: Painless Linear Algebra

Version of the Day

Playa is a user-friendly, representation-independent system of components for development of high-performance parallel linear solvers, nonlinear solvers, and optimizers.

The five fundamental Playa object types are VectorType, VectorSpace, Vector, LinearOperator, and LinearSolver.

Contributors to Playa

Quick start guide

Creating spaces and vectors

Vectors are rarely constructed directly by the user. Instead, they are usually created by a call to the createMember() method of VectorSpace. Similarly, a VectorSpace is usually constructed indirectly by one of the methods of a VectorType object. The user's choice of VectorType subclass specifies which internal object representation will be used.

Here's how to create a Vector distributed with 10 elements per processer, represented internally by an Epetra_Vector object.
VectorType<double> vecType = new EpetraVectorType();
int numPerProc = 10;
VectorSpace<double> space = vecType.createEvenlyPartitionedSpace(MPIComm::world(), numPerProc);
Vector<double> x = space.createMember();
Spaces with more complicated distributions of data over processors can be created with the createSpace() method of VectorType.

Implicit operators

In addition, certain implicit operations can be specified using overloaded operators:

All of these form implicit operators. For example, $z=ABx$ is computed by first computing $y=Bx$, then $z=Ay$. The matrix-matrix product $ AB$ is never explicitly formed.

The implicit inverse and transpose operations can also be done through member functions of LinearOperator, for example,

LinearOperator<double> AInv = A.inverse(mySolver);
LinearOperator<double> ATrans = A.transpose();


Linear solver algorithms are represented by subtypes of LinearSolver.


The Preconditioner object stores a preconditioner with left and right operators. A preconditioner instance will rarely be created directly by the user; it will be created inside a solver by a user-specified subtype of PreconditionerFactory.

Solver Parameters

Linear solvers are usually created from Teuchos ParameterList objects.

LinearSolver<double> amesos = LinearSolverBuilder::createSolver("amesos.xml");

LinearSolver<double> solver = LinearSolverBuilder::createSolver(solverParams);

Amesos parameter example

Amesos is a serial sparse direct solver package.

  <ParameterList name="Linear Solver">
    <Parameter name="Type" type="string" value="Amesos"/>
    <Parameter name="Verbosity" type="int" value="0"/>

Belos parameter examples

Aztec parameter examples

  <ParameterList name="Linear Solver">
    <Parameter name="Max Iterations" type="int" value="500"/>
    <Parameter name="Method" type="string" value="GMRES"/>
    <ParameterList name="Preconditioner">
       <Parameter name="Type" type="string" value="ML"/>
       <Parameter name="Problem Type" type="string" value="SA"/>
       <ParameterList name="ML Settings">
          <Parameter name="output" type="int" value="10"/>
    <Parameter name="Tolerance" type="double" value="1e-12"/>
    <Parameter name="Type" type="string" value="Aztec"/>
    <Parameter name="Verbosity" type="int" value="0"/>