Skip to content

Commit 754c792

Browse files
committed
Merge pull request #14424 from JuliaLang/anj/rankupdate
Rename rank one up- and downdate functions for Cholesky to rank(up/down)date
2 parents 00589c8 + cbf888e commit 754c792

File tree

4 files changed

+17
-14
lines changed

4 files changed

+17
-14
lines changed

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ Library improvements
7070
appropriate. The `sparsevec` function returns a one-dimensional sparse
7171
vector instead of a one-column sparse matrix. ([#13440])
7272

73+
* Rank one update and downdate functions, `lowrankupdate`, `lowrankupdate!`, `lowrankdowndate`,
74+
and `lowrankdowndate!`, for dense Cholesky factorizations ([#14243],[#14424])
75+
7376
* New `foreach` function for calling a function on every element of a collection when
7477
the results are not needed.
7578

base/linalg/cholesky.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,11 @@ chkfullrank(C::CholeskyPivoted) = C.rank < size(C.factors, 1) && throw(RankDefic
267267
rank(C::CholeskyPivoted) = C.rank
268268

269269
"""
270-
update!(C::Cholesky, v::StridedVector) -> CC::Cholesky
270+
lowrankupdate!(C::Cholesky, v::StridedVector) -> CC::Cholesky
271271
272272
Update a Cholesky factorization `C` with the vector `v`. If `A = C[:U]'C[:U]` then `CC = cholfact(C[:U]'C[:U] + v*v')` but the computation of `CC` only uses `O(n^2)` operations. The input factorization `C` is updated in place such that on exit `C == CC`. The vector `v` is destroyed during the computation.
273273
"""
274-
function update!(C::Cholesky, v::StridedVector)
274+
function lowrankupdate!(C::Cholesky, v::StridedVector)
275275
A = C.factors
276276
n = length(v)
277277
if size(C, 1) != n
@@ -310,11 +310,11 @@ function update!(C::Cholesky, v::StridedVector)
310310
end
311311

312312
"""
313-
downdate!(C::Cholesky, v::StridedVector) -> CC::Cholesky
313+
lowrankdowndate!(C::Cholesky, v::StridedVector) -> CC::Cholesky
314314
315315
Downdate a Cholesky factorization `C` with the vector `v`. If `A = C[:U]'C[:U]` then `CC = cholfact(C[:U]'C[:U] - v*v')` but the computation of `CC` only uses `O(n^2)` operations. The input factorization `C` is updated in place such that on exit `C == CC`. The vector `v` is destroyed during the computation.
316316
"""
317-
function downdate!(C::Cholesky, v::StridedVector)
317+
function lowrankdowndate!(C::Cholesky, v::StridedVector)
318318
A = C.factors
319319
n = length(v)
320320
if size(C, 1) != n
@@ -360,15 +360,15 @@ function downdate!(C::Cholesky, v::StridedVector)
360360
end
361361

362362
"""
363-
update(C::Cholesky, v::StridedVector) -> CC::Cholesky
363+
lowrankupdate(C::Cholesky, v::StridedVector) -> CC::Cholesky
364364
365365
Update a Cholesky factorization `C` with the vector `v`. If `A = C[:U]'C[:U]` then `CC = cholfact(C[:U]'C[:U] + v*v')` but the computation of `CC` only uses `O(n^2)` operations.
366366
"""
367-
update(C::Cholesky, v::StridedVector) = update!(copy(C), copy(v))
367+
lowrankupdate(C::Cholesky, v::StridedVector) = lowrankupdate!(copy(C), copy(v))
368368

369369
"""
370-
downdate(C::Cholesky, v::StridedVector) -> CC::Cholesky
370+
lowrankdowndate(C::Cholesky, v::StridedVector) -> CC::Cholesky
371371
372372
Downdate a Cholesky factorization `C` with the vector `v`. If `A = C[:U]'C[:U]` then `CC = cholfact(C[:U]'C[:U] - v*v')` but the computation of `CC` only uses `O(n^2)` operations.
373373
"""
374-
downdate(C::Cholesky, v::StridedVector) = downdate!(copy(C), copy(v))
374+
lowrankdowndate(C::Cholesky, v::StridedVector) = lowrankdowndate!(copy(C), copy(v))

doc/stdlib/linalg.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,25 +161,25 @@ Linear algebra functions in Julia are largely implemented by calling functions f
161161

162162
.. currentmodule:: Base.LinAlg
163163

164-
.. function:: update(C::Cholesky, v::StridedVector) -> CC::Cholesky
164+
.. function:: lowrankupdate(C::Cholesky, v::StridedVector) -> CC::Cholesky
165165

166166
.. Docstring generated from Julia source
167167
168168
Update a Cholesky factorization ``C`` with the vector ``v``\ . If ``A = C[:U]'C[:U]`` then ``CC = cholfact(C[:U]'C[:U] + v*v')`` but the computation of ``CC`` only uses ``O(n^2)`` operations.
169169

170-
.. function:: downdate(C::Cholesky, v::StridedVector) -> CC::Cholesky
170+
.. function:: lowrankdowndate(C::Cholesky, v::StridedVector) -> CC::Cholesky
171171

172172
.. Docstring generated from Julia source
173173
174174
Downdate a Cholesky factorization ``C`` with the vector ``v``\ . If ``A = C[:U]'C[:U]`` then ``CC = cholfact(C[:U]'C[:U] - v*v')`` but the computation of ``CC`` only uses ``O(n^2)`` operations.
175175

176-
.. function:: update!(C::Cholesky, v::StridedVector) -> CC::Cholesky
176+
.. function:: lowrankupdate!(C::Cholesky, v::StridedVector) -> CC::Cholesky
177177

178178
.. Docstring generated from Julia source
179179
180180
Update a Cholesky factorization ``C`` with the vector ``v``\ . If ``A = C[:U]'C[:U]`` then ``CC = cholfact(C[:U]'C[:U] + v*v')`` but the computation of ``CC`` only uses ``O(n^2)`` operations. The input factorization ``C`` is updated in place such that on exit ``C == CC``\ . The vector ``v`` is destroyed during the computation.
181181

182-
.. function:: downdate!(C::Cholesky, v::StridedVector) -> CC::Cholesky
182+
.. function:: lowrankdowndate!(C::Cholesky, v::StridedVector) -> CC::Cholesky
183183

184184
.. Docstring generated from Julia source
185185

test/linalg/cholesky.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ let A = complex(randn(10,5), randn(10, 5)), v = complex(randn(5), randn(5))
152152
for uplo in (:U, :L)
153153
AcA = A'A
154154
F = cholfact(AcA, uplo)
155-
@test LinAlg.update(F, v)[uplo] cholfact(AcA + v*v')[uplo]
156-
@test LinAlg.downdate(F, v)[uplo] cholfact(AcA - v*v')[uplo]
155+
@test LinAlg.lowrankupdate(F, v)[uplo] cholfact(AcA + v*v')[uplo]
156+
@test LinAlg.lowrankdowndate(F, v)[uplo] cholfact(AcA - v*v')[uplo]
157157
end
158158
end

0 commit comments

Comments
 (0)