qr_delete(Q, R, k, int p=1, which=u'row', overwrite_qr=False, check_finite=True)
If A = Q R
is the QR factorization of A
, return the QR factorization of A
where p
rows or columns have been removed starting at row or column k
.
This routine does not guarantee that the diagonal entries of R1
are positive.
Unitary/orthogonal matrix from QR decomposition.
Upper triangular matrix from QR decomposition.
Index of the first row or column to delete.
Number of rows or columns to delete, defaults to 1.
Determines if rows or columns will be deleted, defaults to 'row'
If True, consume Q and R, overwriting their contents with their downdated versions, and returning approriately sized views. Defaults to False.
Whether to check that the input matrix contains only finite numbers. Disabling may give a performance gain, but may result in problems (crashes, non-termination) if the inputs do contain infinities or NaNs. Default is True.
QR downdate on row or column deletions
>>> from scipy import linalg
... a = np.array([[ 3., -2., -2.],
... [ 6., -9., -3.],
... [ -3., 10., 1.],
... [ 6., -7., 4.],
... [ 7., 8., -6.]])
... q, r = linalg.qr(a)
Given this QR decomposition, update q and r when 2 rows are removed.
>>> q1, r1 = linalg.qr_delete(q, r, 2, 2, 'row', False)
... q1 array([[ 0.30942637, 0.15347579, 0.93845645], # may vary (signs) [ 0.61885275, 0.71680171, -0.32127338], [ 0.72199487, -0.68017681, -0.12681844]])
>>> r1 array([[ 9.69535971, -0.4125685 , -6.80738023], # may vary (signs) [ 0. , -12.19958144, 1.62370412], [ 0. , 0. , -0.15218213]])
The update is equivalent, but faster than the following.
>>> a1 = np.delete(a, slice(2,4), 0)
... a1 array([[ 3., -2., -2.], [ 6., -9., -3.], [ 7., 8., -6.]])
>>> q_direct, r_direct = linalg.qr(a1)
Check that we have equivalent results:
>>> np.dot(q1, r1) array([[ 3., -2., -2.], [ 6., -9., -3.], [ 7., 8., -6.]])
>>> np.allclose(np.dot(q1, r1), a1) True
And the updated Q is still unitary:
>>> np.allclose(np.dot(q1.T, q1), np.eye(3)) TrueSee :
The following pages refer to to this document either explicitly or contain code examples using this.
scipy.linalg._decomp_update.qr_insert
scipy.linalg._decomp_update.qr_delete
scipy.linalg._decomp_update.qr_update
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them