linalg 1.6.1
A linear algebra library that provides a user-friendly interface to several BLAS and LAPACK routines.
Loading...
Searching...
No Matches
linalg_core::cholesky_rank1_update Interface Reference

Computes the rank 1 update to a Cholesky factored matrix (upper triangular). More...

Detailed Description

Computes the rank 1 update to a Cholesky factored matrix (upper triangular).

Syntax
subroutine cholesky_rank1_update(real(real64) r(:,:), real(real64) u(:), optional real(real64) work(:), optional class(errors) err)
subroutine cholesky_rank1_update(complex(real64) r(:,:), complex(real64) u(:), optional complex(real64) work(:), optional class(errors) err)
Parameters
[in,out]rOn input, the N-by-N upper triangular matrix R. On output, the updated matrix R1.
[in,out]uOn input, the N-element update vector U. On output, the rotation sines used to transform R to R1.
[out]workAn optional argument that if supplied prevents local memory allocation. If provided, the array must have at least N elements. Additionally, this workspace array is used to contain the rotation cosines used to transform R to R1.
[in,out]errAn optional errors-based object that if provided can be used to retrieve information relating to any errors encountered during execution. If not provided, a default implementation of the errors class is used internally to provide error handling. Possible errors and warning messages that may be encountered are as follows.
  • LA_ARRAY_SIZE_ERROR: Occurs if any of the input array sizes are incorrect.
  • LA_OUT_OF_MEMORY_ERROR: Occurs if local memory must be allocated, and there is insufficient memory available.
Notes
This routine utilizes the QRUPDATE routine DCH1UP (ZCH1UP in the complex case).
See Also
Source
Usage
The following example illustrates the use of the rank 1 Cholesky update, and compares the results to factoring the original rank 1 updated matrix.
program example
use iso_fortran_env, only : real64, int32
implicit none
! Variables
real(real64) :: a(3,3), u(3), au(3,3)
integer(int32) :: i
! Build the 3-by-3 positive-definite matrix A.
! | 4 12 -16 |
! A = | 12 37 -43 |
! |-16 -43 98 |
a = reshape([4.0d0, 12.0d0, -16.0d0, 12.0d0, 37.0d0, -43.0d0, -16.0d0, &
-43.0d0, 98.0d0], [3, 3])
! Build the update vector U
u = [0.5d0, -1.5d0, 2.0d0]
! Compute the rank 1 update of A
au = a
call rank1_update(1.0d0, u, u, au)
! Compute the Cholesky factorization of the original matrix
! Apply the rank 1 update to the factored matrix
! Compute the Cholesky factorization of the update of the original matrix
call cholesky_factor(au)
! Display the matrices
print '(A)', "Updating the Factored Form:"
do i = 1, size(a, 1)
print *, a(i,:)
end do
print '(A)', "Updating A Directly:"
do i = 1, size(au, 1)
print *, au(i,:)
end do
end program
Computes the Cholesky factorization of a symmetric, positive definite matrix.
Computes the rank 1 update to a Cholesky factored matrix (upper triangular).
Performs the rank-1 update to matrix A such that: , where is an M-by-N matrix, is a scalar,...
Provides a set of common linear algebra routines.
Definition: linalg_core.f90:15
The above program produces the following output.
Updating the Factored Form:
2.0615528128088303 5.4570515633174921 -7.2760687510899889
0.0000000000000000 3.0774320845949008 -2.0452498947307731
0.0000000000000000 0.0000000000000000 6.6989384530323566
Updating A Directly:
2.0615528128088303 5.4570515633174921 -7.2760687510899889
0.0000000000000000 3.0774320845949008 -2.0452498947307736
0.0000000000000000 0.0000000000000000 6.6989384530323557

Definition at line 1492 of file linalg_core.f90.


The documentation for this interface was generated from the following file: