Blog posts

2023

The Jacobi algorithm for eigenvalues

2 minute read

Published:

Jacobi algorithm

Given a symmetric $A \in \mathbb{R}^{n\times n}$, the Jacobi algorithm produces a sequence of orthogonally similar matrices $A_{k+1} = J_{k}^{T} A_{k} J_{k}$ for $k = 1,2,\dots$, $A_{1} = A$, and $J_{k}$ are the carefully constructed Jacobi rotations. In fact, the Jacobi rotation is the same as the Givens rotation, but we give the credit to the inventor, Carl G. J. Jacobi. Read more

A MATLAB function to generate random symmetric matrix

3 minute read

Published:

The MATLAB builtin function gallery('randsvd',...) can only generate a random matrix or a symmetric positive definite matrix. However, sometimes, we need to test our algorithms for symmetric matrices. Although you can get a symmetric matrix by A = randn(n); A = A + A';, it would be nice to inherit the features from gallery('randsvd'), such as the ability to control the distributions of the singular values. The attached code achieves such desire by

  • first, generate singular values,
  • then construct a random orthogonal matrix using qmult, and
  • finally multiply the orthogonal matrix at both sides of the diagonal matrix that contains these singular values.
Read more