CS5107
error name needs a square symmetric matrix in this version.
#What it means
In this version, matrix.eigenvalues and matrix.eigenvectors work on square symmetric matrices only: the value at row i, column j must equal the value at row j, column i.
#Typical cause
- A matrix that is not symmetric, such as one built from unrelated data.
#How to fix it
Make sure the matrix is symmetric, for example a covariance matrix, or build it as (m + m.transpose()) / 2 when that suits your purpose.
#Example
//@chartscript 1
indicator("Eigenvalues")
const m = matrix.new<float>(2, 2, 1.0)
m.set(0, 1, 2.0)
const ev = m.eigenvalues()
plot(ev.get(0))Fixed
//@chartscript 1
indicator("Eigenvalues")
const m = matrix.new<float>(2, 2, 1.0)
m.set(0, 1, 2.0)
m.set(1, 0, 2.0)
const ev = m.eigenvalues()
plot(ev.get(0))#Related
- CS5106 — The matrix sizes do not fit (detail).