Enter forum description here ...
0
Є відповідь

SVD behavior in mp different from Matlab when applied to negative scalar

Denis Tkachenko 10 років тому оновлений 10 років тому 2

I have the following question:


In one of my examples I need to compute the Singular Value Decomposition (SVD) of a negative scalar, specifically -0.7276.


In double precision, Matlab returns:

>> [U S V]=svd(-0.7276)

U = -1
S = 0.7276
V =1


In MP, I obtain:


s=mp('-0,7276');


>> [U,S,V]=svd(s)


U = 1
S = -0.7276
V = 1


The definition of SVD states that the matrix S should have nonnegative diagonal entries. In the above example, the first two elements seem to be multiplied by -1 compared to Matlab output. While the product doesn't change, the unexpected negative sign of the singular value causes problems in subsequent code.


Is this a bug or is there an option to make it return the same output as Matlab's svd?


The 4.2.3.11967 release of the toolbox was used.

Thank you,

Denis

Відповідь
Pavel Holoborodko 10 років тому

Dear Denis,

Thank you very much for the report!


Indeed, this is bug and it has been fixed in latest build.

Please download updated version: http://goo.gl/pMXV3


Thank you,

Pavel.

0
Виконано

How can I run FresnelS and FresnelC functions?

JinhakKim 10 років тому оновлено Pavel Holoborodko 10 років тому 1

When I add the multiprecision computing toolbox and type FresnelS(1) in matlab command, I get the following error message.


Cannot find an exact (case-sensitive) match for 'FresnelS'

The closest match is: fresnels in C:\Program
Files\MATLAB\R2016a\toolbox\symbolic\symbolic\@double\fresnels.m


Also, when I type fresnels(mp(1)), I get


Undefined function 'fresnels' for input arguments of type 'mp'.


How can I solve this problem?

0
Under review

Nonequidistant FFT

didier clamond 10 років тому оновлено Pavel Holoborodko 10 років тому 6

Dear Pavel,


It would be great to support the non-equidistant Fast Fourier Transform.

https://www-user.tu-chemnitz.de/~potts/nfft/


Regards,

Didier

0
Є відповідь

Integer matrix

keuguz 10 років тому оновлено Pavel Holoborodko 10 років тому 1

I have matrices they are made of integers. Do I need to define mp even for integers? For example:


N=100;

A=(zeros(N+1,N+1));

for l=1:N;

for k=mod(l-1,2):3:l;

A(k+1,l+1)=3*l;

end

end


and


p=0:1:N;

kron(p',p);


and


I=ones(N+1,1);

II=(-1).^(0:N);

G=kron(I,II);


Integer is normally considered as infinite precision. I use these matrices in further calculation with non-integer matrices, therefore, results. But using mp.Digits(100) for example costs me a lot in here for no gain actually.

0
Є відповідь

Is there a mp-version of Matlab's function 'eps' ?

Roland K 10 років тому оновлено Denis Tkachenko 10 років тому 4
0
Виконано

Error using pinv

Hector 10 років тому оновлено Pavel Holoborodko 10 років тому 8

??? Error using ==> mp>mp.pinv at 2964

DGESSD failed with exit code = 4
Error in ==> LM_Rtc at 77
s=pinv(a)*b
0
Є відповідь

Extremely slow interp1

m b 10 років тому оновлено Pavel Holoborodko 10 років тому 4

Hi,

Could you please advise why interp1 with mp is so slow compared to original matlab interp1? belwo is the example I'm running. Thank you for your kind help

mohsen


% Grid length and useful vectors
N = 200;
kp = mp(linspace(1e-6,5,N))';
n = mp( ones(1,2)); nn = mp(ones(N,1));


% parameters & given values
gam = 2; beta = 0.96;
R = 1.05; w0 = 3.44;
prob = mp([0.9500, 0.0500; 0.6750, 0.3250]);


w = mp(sort( w0*( .995 + randn(N,1)/7.5 ) ));
W = [w, 0*nn];


% initialize
Cp = mp(R)*kp*n; k = Cp;


% convergence criterion
Cp_crit = 1;


% Interpolate until convergence
ii = 0; tic

while Cp_crit > 1e-3
Cp0 = Cp;
EMUp = (Cp.^(-mp(gam)))*prob';
C = (mp(beta*R)*EMUp).^(-1/mp(gam));
k = ( kp*n + C - W)/mp(R);

% Use the relation between C and k to ropose a new vector Cp corresponding to kp
for i=1:2
% Update the function by interpolation.
Cp(:,i) = interp1(k(:,i), C(:,i), kp,'linear','extrap');
end

Cp_crit = max(max(abs(Cp0-Cp)./(1+abs(Cp))));
ii = ii+ 1;
end
toc
disp(Cp_crit)


0
Fixed

Bug in relational operations

Michael_ 10 років тому оновлено Pavel Holoborodko 10 років тому 3

Hi.

I think there is a bug in the relational operations "equal" and "unequal"


test(:,1)=(1:4)';

testmp=mp(test);


This works:

test==1
ans =
1
0
0
0
testmp==1
ans =
1
0
0
0

This doesn't

1==test
ans =
1
0
0
0
1==testmp
ans =
1


This has worked in previous versions though.

Best regards,

Michael

0
Є відповідь

Larger numbers

Hector 10 років тому оновлено Pavel Holoborodko 10 років тому 10

Pavel, there are larger numbers than 1e + 308 and less than 1e-318 ?

0
Виконано

use save and load

Hector 10 років тому оновлено Pavel Holoborodko 10 років тому 1

how to use the command save and load the data mp ?

more precisely as save sets of objects containing mp elements, then load them ?,

or such as saving array mp text and then load ?