linalg¶
-
class
pyviennacl.linalg.bicgstab_tag(tolerance=1e-08, max_iterations=400, max_iterations_before_restart=200)¶ Instruct the solver to solve using the stabilised bi-conjugate gradient (BiCGStab) solver.
Assumes that the system matrix is non-symmetric.
Used for supplying solver parameters.
-
error¶ The estimated relative error at the end of the solver run
-
iters¶ The number of solver iterations
-
max_iterations¶ The maximum number of iterations before a restart
-
tolerance¶ The relative tolerance
-
-
class
pyviennacl.linalg.cg_tag(tolerance=1e-08, max_iterations=300)¶ Instruct the solver to solve using the conjugate gradient solver.
Assumes that the system matrix is symmetric positive definite.
Used for supplying solver parameters.
-
error¶ The estimated relative error at the end of the solver run
-
iters¶ The number of solver iterations
-
max_iterations¶ The maximum number of iterations
-
tolerance¶ The relative tolerance
-
-
pyviennacl.linalg.eig(A, tag)¶ Solve an eigenvalue problem for matrix
A, with results depending ontag.A : Matrix tag : eigenvalue computation tag instance
Must be one of * power_iter_tag * lanczos_tag See the help for each tag class for more information.- x : {scalar, array-like}
- Return type depends on
tag* if power_iter_tag, then a scalar of typedtype(A).type* if lanczos_tag, then anndarrayvector with same dtype asA
- TypeError
- If
Ais not aMatrixinstance, or iftagis not understood
-
class
pyviennacl.linalg.gmres_tag(tolerance=1e-08, max_iterations=300, krylov_dim=20)¶ Instruct the solver to solve using the GMRES solver.
Used for supplying solver parameters.
-
error¶ The estimated relative error at the end of the solver run
-
iters¶ The number of solver iterations
-
krylov_dim¶ The maximum dimension of the Krylov space before restart
-
max_iterations¶ The maximum number of iterations
-
max_restarts¶ The maximum number of GMRES restarts
-
tolerance¶ The relative tolerance
-
-
class
pyviennacl.linalg.lanczos_tag(factor=0.75, num_eig=10, method=0, krylov=100)¶ Instruct the eigenvalue computation to use the Lanczos algorithm.
Used for supplying eigenvalue computation parameters.
-
factor¶ The tolerance factor for reorthogonalisation batches, expressed as the exponent of epsilon.
-
krylov_size¶ The size of the Kylov space.
-
method¶ The reorthogonalisation method choice.
-
num_eigenvalues¶ The number of eigenvalues to return.
-
-
class
pyviennacl.linalg.lower_tag¶ Instruct the solver to solve for a lower triangular system matrix
-
pyviennacl.linalg.norm(x, ord=None)¶ Returns the vector norm of
x, if that is defined.The norm returned depends on the
ordparameter, as in SciPy.- ord : {1, 2, inf}
- Order of the norm. inf means NumPy’s
infobject.
-
pyviennacl.linalg.plane_rotation(vec1, vec2, alpha, beta)¶ Computes (vec1, vec2) <- (alpha*vec1+beta*vec2, -beta*vec1+alpha*vec2)
vec1 : Vector vec2 : Vector alpha : any Python, NumPy or PyViennaCL scalar (real or integer) beta : any Python, NumPy or PyViennaCL scalar (real or integer)
None
The dtypes of the parameters must match.
Operates in-place on vec1 and vec2.
-
class
pyviennacl.linalg.power_iter_tag(factor=1e-08, max_iterations=50000)¶ Instruct the eigenvalue computation to use the power iteration algorithm.
Used for supplying eigenvalue computation parameters.
-
factor¶ The termination factor.
If the eigenvalue does not change more than this value, the algorithm stops.
-
max_iterations¶ The maximum number of iterations
-
-
pyviennacl.linalg.prod(A, B)¶ Returns
Mul(A, B)where that is defined (see the help forMul), otherwise returns(A * B).
-
pyviennacl.linalg.solve(A, B, tag, precond=None)¶ Solve the linear system expressed by
A x = Bforx.- A : (M, M) dense or sparse Matrix
- A square matrix
- B : {Vector, Matrix}
- Right-hand side in
A x = B - tag : solver tag instance
- Describes the system matrix and solver algorithm. Must be one of: * upper_tag * unit_upper_tag * lower_tag * unit_lower_tag * cg_tag * bicgstab_tag * gmres_tag See the help for each tag class for more information.
- x : {Vector, Matrix}
- Shape and class of
xmatches shape and class ofB.
- TypeError
- If
Ais not aMatrixorSparseMatrixBaseinstance, orBis neither aMatrixnor aVectorinstance, or iftagis unsupported.
-
class
pyviennacl.linalg.unit_lower_tag¶ Instruct the solver to solve for a unit lower triangular system matrix
-
class
pyviennacl.linalg.unit_upper_tag¶ Instruct the solver to solve for a unit upper triangular system matrix
-
class
pyviennacl.linalg.upper_tag¶ Instruct the solver to solve for an upper triangular system matrix