pypcga.mgs_stable#

pypcga.mgs_stable(A: ndarray[tuple[Any, ...], dtype[float64]], Z: ndarray[tuple[Any, ...], dtype[float64]], verbose=False) Tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]][source]#

Returns QR decomposition of Z with Q*AQ = I.

Q and R satisfy the following relations in exact arithmetic:

  1. QR = Z

  2. Q^*AQ = I

  3. Q^*AZ = R

  4. ZR^{-1} = Q

Uses Modified Gram-Schmidt with re-orthogonalization (Rutishauser variant) for computing the A-orthogonal QR factorization

Parameters:
  • A ({sparse matrix, dense matrix, LinearOperator}) – An array, sparse matrix, or LinearOperator representing the operation A * x, where A is a real or complex square matrix.

  • Z (ndarray) – TODO/

  • verbose (bool, optional) – Displays information about the accuracy of the resulting QR Default: False

Returns:

  • q (ndarray) – The A-orthogonal vectors

  • Aq (ndarray) – The A^{-1}-orthogonal vectors

  • r (ndarray) – The r of the QR decomposition

See also

mgs

Modified Gram-Schmidt without re-orthogonalization

precholqr

Based on CholQR

References

Examples

>>> import numpy as np
>>> A = np.diag(np.arange(1,101))
>>> Z = np.random.randn(100,10)
>>> q, Aq, r = mgs_stable(A, Z, verbose = True)