# `pygsti.optimize.customsolve`

A custom MPI-enabled linear solver.

## Module Contents

### Functions

 `custom_solve`(a, b, x, ari, resource_alloc[, ...]) Simple parallel Gaussian Elimination with pivoting.
pygsti.optimize.customsolve.custom_solve(a, b, x, ari, resource_alloc, proc_threshold=100)

Simple parallel Gaussian Elimination with pivoting.

This function was built to provide a parallel alternative to scipy.linalg.solve, and can achieve faster runtimes compared with the serial SciPy routine when the number of available processors and problem size are large enough.

When the number of processors is greater than proc_threshold (below this number the routine just calls scipy.linalg.solve on the root processor) the method works as follows:

• each processor “owns” some subset of the rows of a and b.

• iteratively (over pivot columns), the best pivot row is found, and this row is used to eliminate all other elements in the current pivot column. This procedure operations on the joined matrix a|b, and when it completes the matrix a is in reduced row echelon form (RREF).

• back substitution (trivial because a is in reduced REF) is performed to find the solution x such that a @ x = b.

#### Parameters

aLocalNumpyArray

A 2D array with the ‘jtj’ distribution, holding the rows of the a matrix belonging to the current processor. (This belonging is dictated by the “fine” distribution in a distributed layout.)

bLocalNumpyArray

A 1D array with the ‘jtf’ distribution, holding the rows of the b vector belonging to the current processor.

xLocalNumpyArray

A 1D array with the ‘jtf’ distribution, holding the rows of the x vector belonging to the current processor. This vector is filled by this function.

ariArraysInterface

An object that provides an interface for creating and manipulating data arrays.

resource_allocResourceAllocation

Gives the resources (e.g., processors and memory) available for use.

proc_thresholdint, optional

Below this number of processors this routine will simply gather a and b to a single (the rank 0) processor, call SciPy’s serial linear solver, scipy.linalg.solve, and scatter the results back onto all the processors.

None