问题
I want to check numerical stability of QR algorithm, for this i need to create matrix like this:
S = diag(2.^(-1:-1:-80));
But it has rank 46, i think it is because of lack of accuracy. But in the book i'm reading it is full ranked matrix. How can i increase accuracy of computations?
回答1:
You can use vpa (variable precision ariuthmetic):
>> S = diag(2.^vpa((-1:-1:-80)), 100); %// 100 here is number of precision digits
>> rank(S)
ans =
80
Note that the result is of type sym
. Convert to double
if needed:
>> double(rank(S))
ans =
80
来源:https://stackoverflow.com/questions/26358785/matlab-float-accuracy