Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sedumi:function handle problem in minpsdeig.m #64

Closed
crucis0 opened this issue Apr 16, 2021 · 3 comments
Closed

sedumi:function handle problem in minpsdeig.m #64

crucis0 opened this issue Apr 16, 2021 · 3 comments
Assignees
Labels

Comments

@crucis0
Copy link

crucis0 commented Apr 16, 2021

in minpsdeig.m (line 70)

sedumi/minpsdeig.m

Lines 66 to 74 in 2996306

XX = reshape(XX,ki,ki);
XX = XX + XX';
if ki > 500
if nnz(XX) < 0.1 * numel(XX), XX = sparse(XX); end
[v,eigv(i),flag] = eigs(XX,1,'SA',struct('issym',true)); %#ok
if flag, eigv(i) = min(eig(XX)); end
else
eigv(i) = min(eig(XX));
end

there may be an issue in function eigs(XX,1,,‘SA'......)
matlab warn that XX is not a function handle.

@siko1056
Copy link
Member

siko1056 commented Apr 16, 2021

This change was done in 58d78d0, according to the Matlab documentation

  • opts — Options structure
    Option Field Description Name-Value Pair
    issym Symmetry of Afun matrix. 'IsFunctionSymmetric'

and

'IsFunctionSymmetric' — Symmetry of Afun matrix

and

Afun — Matrix function
function handle
Matrix function, specified as a function handle.

Matlabs warning seems justified here, as XX is a symmetric matrix .

The function is only used in this calling-order:

sedumi
  wregion
    maxstep
      minpsdeig

Maybe this is why this issue has not been hit often in the past. Can you provide a minimal example producing this warning message?

@siko1056 siko1056 added the bug label Apr 16, 2021
@siko1056
Copy link
Member

The most simple fix is to just remove the struct from the call. Again according to the Matlab documentation:

If A is symmetric, then eigs uses a specialized algorithm for that case. If A is nearly symmetric, then consider using A = (A+A')/2 to make A symmetric before calling eigs. This ensures that eigs calculates real eigenvalues instead of complex ones.

Thus no special care for A is necessary to flag it symmetric. If there are no other opinions about it (or problems with older versions I am not aware of) I'll fix this in a few days.

@siko1056
Copy link
Member

No further comments, merged #65 . Thanks again for your report 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants