0
Résolu
Integer matrix
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.
Service d'assistance aux clients par UserEcho
Integer matrices have to be converted to mp only if they participate in floating-point operations later on.
In this particular cases, just convert the matrices to mp after forming them as integers:
P.S.
There is no integer matrices in MATLAB (unless you create them with explicit type - zeros(...,'int32')).
By default, zeros, ones, and everything else is created as double matrices. The floating-point is just not shown if number has no fractional part.