R2022a incompatibility
>> mp.Test
nthroot() :Error using char/eps
Too many input arguments.
Error in nthroot (line 35)
m = x ~= 0 & (abs(x) < 1./eps('like',y)) & isfinite(n);
Error in mptest (line 1298)
d = nthroot(X,Y)-nthroot(mp(X),mp(Y));
Error in mp.Test (line 300)
mptest(); % Run tests
Ответ
We didn't ensure compatibility with R2022a yet.
Looks like now they enforce double quote strings instead of single as arguments.
This will affect a lot of functions - all elementary arrays, etc. Breaking this compatibility is the stupidest thing ever (!).
Do you see any way option to turn on the compatibility with old versions of MATLAB (so that we can still call eps('like') instead of eps("like"))?
Please ignore my previous reply because I was wrong and situation is completely different.
I have investigated this in more detail. This error has no relation to toolbox at all. Error happens in 'nthroot' for 'double' arguments.
Looks like you are using 'nthroot' from some old(er) version of MATLAB? Maybe it is somewhere in the search path?
The thing is, Mathworks changed syntax of 'eps' functions since around R2021b (at least this is what I find in my tests).
Two-argument call to 'eps' is not supported anymore. So that eps('like', y) leads to error.
To fix this error, open your nthroot.m and change the call to 'eps' in line 35 from
eps('like',y)
to
eps(class(y))
Funnily enough, web documentation still incorrectly shows that eps('like',y) is supported.
But offline documentation states it is not (already for R2021b) - this is correct.
By the way, 'eps' in toolbox still supports two-argument calls without any issues.
I tried to investigate this problem more deeply, too. Two arguments call to 'eps' is still fully supported at R2022a!!! The only change is the double quote strings instead of single.
But!!! TMW made a mistake and use in version R2022a some outdated version of 'nthroot' function with single quote at line 35 (nthroot.m) :)
That is all ...
Moreover:
1. R2021b: nthroot.m line 35: m = x ~= 0 & (abs(x) < (1/eps(class(y)))) & isfinite(n);
2. R2022a: nthroot.m line 35: m = x ~= 0 & (abs(x) < 1./eps('like',y)) & isfinite(n);
OK, my final observations are as follows:
1. Without MTC 4.8.6 Build 14636 at the PATH commands eps('like',y) and eps("like",y) works both identically and well on R2022a
2. With MTC 4.8.6 Build 14636 at the PATH works only eps("like",y), the eps('like', y) produce above mentioned error on R2022a
3. R2021b used eps(class(y)) instead of R2022a, which is using esp('like',y) at nthroot.m
R2021b ... function eps does not support two arguments call
R2022a ... function eps support two arguments call (!!!), but presence of MTC at PATH introduce some problem with single quote argument used at ntroot.m
From my point of view, the current problem with R2022a is introduced by MTC
I see, this was helpful, thank you!
Now situation is clear. MATLAB R2022a introduced incompatibility with previous versions of MATLAB.
The issue is - R2022a chooses wrong function overload. MCT provides custom overload for 'eps' function which accepts only one argument. Two-argument calls must be re-directed to the built-in 'eps'. All previous versions of MATLAB handled this correctly. But starting from R2022a, MATLAB (incorrectly) tries to use one-argument overload for two-argument calls.
Obviously this leads to error "Too many input arguments".
Actually this issue is a bug. Overloads look-up rules are quite clear and strict in the world of OOP, it cannot be changed on a whim. Lots of existing MATLAB code might be broken because of this change.
We will add workaround for this issue to MCT, so that our overload will handle one and two-argument calls.
At the moment, please replace the content of [toolbox_dir]/@char/eps.m with the following code:
function r = eps( varargin ) if strcmpi('mp',varargin{end}) || strcmpi('mp',class(varargin{end}))
r = mpimpl(2000);
else
r = builtin('eps',varargin{:});
end end
Let me know if this fixes the issue.
Сервис поддержки клиентов работает на платформе UserEcho
I see, this was helpful, thank you!
Now situation is clear. MATLAB R2022a introduced incompatibility with previous versions of MATLAB.
The issue is - R2022a chooses wrong function overload. MCT provides custom overload for 'eps' function which accepts only one argument. Two-argument calls must be re-directed to the built-in 'eps'. All previous versions of MATLAB handled this correctly. But starting from R2022a, MATLAB (incorrectly) tries to use one-argument overload for two-argument calls.
Obviously this leads to error "Too many input arguments".
Actually this issue is a bug. Overloads look-up rules are quite clear and strict in the world of OOP, it cannot be changed on a whim. Lots of existing MATLAB code might be broken because of this change.
We will add workaround for this issue to MCT, so that our overload will handle one and two-argument calls.
At the moment, please replace the content of [toolbox_dir]/@char/eps.m with the following code:
Let me know if this fixes the issue.