42 const number tol3,
const ring
R)
47 number* eigenVs =
new number[n];
int eigenL = 0;
49 bool worked =
qrDS(n, queue, queueL, eigenVs, eigenL, tol1, tol2,
R);
53 for (
int i = 0;
i < eigenL;
i++)
56 for (
int i = 0;
i < queueL;
i++)
61 result->m[0].data = (
void*)0;
68 number* distinctEVs =
new number[n];
int distinctC = 0;
69 int*
mults =
new int[n];
70 for (
int i = 0;
i < eigenL;
i++)
72 int index =
similar(distinctEVs, distinctC, eigenVs[
i], tol3);
75 distinctEVs[distinctC] =
nCopy(eigenVs[
i]);
76 mults[distinctC++] = 1;
84 eigenvalues->
Init(distinctC);
86 multiplicities->
Init(distinctC);
87 for (
int i = 0;
i < distinctC;
i++)
95 delete [] distinctEVs;
delete []
mults;
99 result->m[0].data = (
char*)eigenvalues;
101 result->m[1].data = (
char*)multiplicities;
INLINE_THIS void Init(int l=0)
#define idDelete(H)
delete an ideal
bool qrDS(const int, matrix *queue, int &queueL, number *eigenValues, int &eigenValuesL, const number tol1, const number tol2, const ring R)
int similar(const number *nn, const int nnLength, const number n, const number tolerance)
Tries to find the number n in the array nn[0..nnLength-1].
lists qrDoubleShift(const matrix A, const number tol1, const number tol2, const number tol3, const ring r=currRing)
Computes all eigenvalues of a given real quadratic matrix with multiplicites.
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
static int index(p_Length length, p_Ord ord)
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...