Error using pinv
??? Error using ==> mp>mp.pinv at 2964
Extremely slow interp1
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)
Bug in relational operations
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
use save and load
more precisely as save sets of objects containing mp elements, then load them ?,
or such as saving array mp text and then load ?
sortrows use
I have an object X of type 100 x 4 mp
As it is done to work with subs ?
clc
%addpath('.....................\Multiprecision Computing Toolbox\')
syms A B C;
T=A+B*C;
mp.Digits(20);
a=37456795;
t=subs(T,{'A','B','C'},{a,b,c})
now I want a b c t are multiple precision
MSCALE
M = [ 1.4334 0.7382 1.8723;
0.7298 0.1605 3.0624;
2.7983 1.5972 0.5769];
[s,p] = mscale(mp(M), 'safebal', 'perm');
In an assignment A(:) = B, the number of elements in A and B must be the same.
Error in mpmscale
COMPLEX (& perhaps ISREAL) method - wrong behavior
>> c1 = complex(12)
c1 =
12 + 0i
>> isreal(c1)
ans =
0
>> c2 = complex(mp(12))
c2 =
12
>> isreal(c2)
ans =
1
Customer support service by UserEcho