Matlab 2019b optimoptions not work on sparse jacobPattern anymore

1 回表示 (過去 30 日間)
DIZHONG ZHU
DIZHONG ZHU 2019 年 11 月 21 日
編集済み: Steve Grikschat 2020 年 7 月 2 日
I have just recently update to Matlab2019b, but the optmoptions did not work as I expect.
For example I have sparse jacobian pattern matrix create by A=speye(100000) and feed to optimoption by
'options = optimoptions(@fsolve,'Display','iter','JacobPattern',J,'Algorithm','trust-region','SubproblemAlgorithm','cg');'
It just complain as follows, seems Matlab2019b tries to construct a dense matrix from the sparse. While this code will work on Matlab2018b.
bug.png
Anyone can help for that, please? Thanks

採用された回答

Steve Grikschat
Steve Grikschat 2019 年 11 月 22 日
編集済み: Steve Grikschat 2020 年 7 月 2 日
This is a bug in optimoptions in R2019b. Thanks for reporting this!
As a workaround until it is fixed, you can use optimset
options = optimset('Display','iter','JacobPattern',J,'Algorithm','trust-region','SubproblemAlgorithm','cg');
======== Update ==========
Note, this bug is fixed in R2020a and later releases.
  3 件のコメント
Steve Grikschat
Steve Grikschat 2020 年 7 月 1 日
Does the line of code above not work? What is the error?
Do you have Optimization Toolbox? If not, then the line above will not work.
Alan Weiss
Alan Weiss 2020 年 7 月 2 日
The syntax for optimset is a little different than optimoptions. Did you try the code as Steve wrote it? This works for me:
J = speye(1e5);
options = optimset('Display','iter','JacobPattern',J,'Algorithm','trust-region','SubproblemAlgorithm','cg');
Alan Weiss
MATLAB mathematical toolbox documentation

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by