Algorithm - 2023.2 English

Vitis Libraries

Release Date
2023-12-20
Version
2023.2 English

The calculation process of one-sided Jacobi SVD method is as follows:

  1. Initialize matrix V = I
  2. Select two columns (i, j), i < j, of matrix A, namely \(A_i\) and \(A_j\). Accumulate two columns of data by fomular
\[\begin{split}&b_{ii} = A_i^TA_i = ||A_i||^2 \\ &b_{jj} = A_j^TA_j = ||A_j||^2 \\ &b_{ij} = A_i^TA_j\end{split}\]

A \(2 \times 2\) matrix can be obtained and noted as:

\[\begin{split}\begin{bmatrix} b_{ii}\ b_{ij}\\ b_{ji}\ b_{jj}\\ \end{bmatrix}\end{split}\]

where \(b_{ij}\) equals \(b_{ji}\).

  1. Solve the \(2 \times 2\) symmetric SVD with Jacobi rotation:
\[\begin{split}&\tau = (b_{ii} - b_{jj}) / (2 * b_{ij})) \\ &t = sign(\tau)/(|\tau| + \sqrt{(1 + \tau^2)}) \\ &c = 1 / \sqrt{(1+t^2)} \\ &s = c * t \\\end{split}\]

if we put s and c in a matrix as J, then J equals

\[\begin{split}\begin{bmatrix} 1\ \ \ \ \ 0\ ...\ 0\ \ 0\ \\ 0\ \ \ \ \ c\ ...\ s\ \ 0\ \\ 0\ \ \ \ \ 0\ ...\ 0\ \ 0\ \\ 0\ -s\ ...\ c\ \ 0\ \\ 0\ \ \ \ \ 0\ ...\ 0\ \ 1\ \\ \end{bmatrix}\end{split}\]
  1. Update the i and j columns of matrix A and V by
\[\begin{split}A = A J\\ V = V J\end{split}\]
  1. Calculate converage of \(2 \times 2\) matrix by
\[conv = |b_{ij}| / \sqrt{(b_{ii}b_{jj})}\]

and select the max converage of all pairs (i, j).

  1. Repeat steps 2-4 until all pairs of (i, j) are calculated and updated.
  2. If the max converage among all paris of (i, j) is bigger than 1.e-8, repeat steps 2-6 again, which is also called one sweep.
  3. When the converge is small enough, calculate the matrix U and S for each \(i = 1, ..., n\) by
\[\begin{split}&s_i =||a_i||_2 \\ &u_i = a_i / s_i\end{split}\]