Enter forum description here ...
0
Under review

Performance comparison

Michal Kvasnicka 3 years ago updated 2 years ago 8

I propose to perform update of the whole MCT performance analysis (paragraph Performance here) with latest versions of MATLAB (2021a_update2), Mathematica (12.3) and Maple (2021.0). I am wiling to perform this analysis, because I have an access to latest version of mentioned SW packages.

I spent some time to discuss with MathWorks guys current "terrible" performance of VPA (Matlab 2021a). So, I thing that is a suitable time to update this comparison and show what is the current performance of MCT together with comparisons.



Answer
Pavel Holoborodko 2 years ago

Sorry to hear about miscommunication with "big boys". But I am not surprised at all, as my experience with them was the same. I communicated with several top technical people, they tried to extract deep technical information about toolbox internals (and why it is so much faster), but never provided anything in return.  Later on, I saw they tried to implement some  of toolbox's technical "know-hows", but without much success, as I didn't reveal all the details :).

In any case, thank you very much for your time and efforts. Hopefully we can return to this topic later on.

0
Answered

Conversion from string to mp is 4 times as slow than vpa.

Jacob 3 years ago updated by Pavel Holoborodko 3 years ago 6

I am trying to speed up a program I wrote using MATLAB's built in VPA function. I am working with integers on the order of 5 to 6 million digits. The bottleneck in my code was converting a string to VPA where the conversion would take around 2.5 seconds. In order to solve this I thought I would use the Multiprecision Computing Toolbox. I downloaded the free trial and only made 2 alterations to my code. I set the mp.Digits value to 10 million (the same as the vpa digits value) and I replaced my vpa() function with mp(). After running the code multiple times I found that the mp version was significantly slower. As you can see in the picture below conversion to mp took 10 seconds while conversion to vpa took 2.5 seconds. Since I am new to the Multiprecision Computing Toolbox I very well could misunderstand how it is supposed to work. If anyone could tell me either a better way to solve my speed issue, and/or why mp is slower then please let me know.

Image 41

Answer
Pavel Holoborodko 3 years ago

Ok, great, please keep us updated on your experience with toolbox.

0
Answered

nchoosek, binomial coefficient

dattorro 3 years ago updated 2 years ago 4

How do we increase dynamic range of Matlab's binomial coefficient function nchoosek()?

It will not accept multiprecision mp() input.

0
Answered

speed up of expm (4.8.3.14440)

Michal Kvasnicka 3 years ago updated by Pavel Holoborodko 3 years ago 3

The presented improvement of expm speed (version 4.8.3.14440) is for mp.Digits = 34 or 100???

0
Fixed

R2020b problem

Michal Kvasnicka 4 years ago updated by Pavel Holoborodko 4 years ago 6

Matlab R2020b (Windows) is not fully compatible with latest version of MCT:

OMP: Info #273: omp_set_nested routine deprecated, please use omp_set_max_active_levels instead. 

On Linux I can test only old version 4.7.0 Build 13589 which does not report this problem. Just the message:

cat: /etc/upstream-release: Is a directory

on matlab exit.

Answer
Pavel Holoborodko 4 years ago

Thank you for confirmation!

0
Completed

Yasutaka Hanada benchmark

Michal Kvasnicka 4 years ago updated by Pavel Holoborodko 4 years ago 1

I just read the Yasutaka Hanada benchmark report which is mentioned at the recent MCT Version history update.

The presented results are really very impressive! Current version of MCT definitely offer best multi-precision performance over commonly used high level computing languages (except MAPLE, which is typically terrible slow). Congratulation!!!

0
Answered

multiplication / addition performance

ccc 4 years ago updated by Pavel Holoborodko 4 years ago 3

is there a speed-up when we do the vector-matrix multiplication addition by using your toolbox?

Answer
Pavel Holoborodko 4 years ago

Your question is not clear. "Speed-up" compared to what?

If we would compare it to VPA then we see ~53 times speed-up:

>> A = vpa(rand(1000));
>> x = vpa(rand(1000,1));
>> tic; y = A*x; toc;
Elapsed time is 1.143934 seconds.
>> A = rand(1000,'mp');
>> x = rand(1000,1,'mp');
>> tic; y = A*x; toc;
Elapsed time is 0.021398 seconds.
0
Answered

sort performance

ccc 4 years ago updated by Pavel Holoborodko 4 years ago 1

what is the performance of sort function of this toolbox?

Are there any comparison studies?

Answer
Pavel Holoborodko 4 years ago

We use quicksort algorithm, which is pretty much de-facto standard in all programming languages.

If we compare sort speed of our toolbox and VPA: 


>> A = vpa(rand(10000,1));
>> tic; sort(A); toc;
Elapsed time is 0.065205 seconds.

>> A = rand(10000,1,'mp');
>> tic; sort(A); toc;
Elapsed time is 0.003493 seconds.

So, our toolbox is ~19 times faster.

0
Declined

arrayfun

husain_javan 4 years ago updated by Pavel Holoborodko 4 years ago 3

is there a way to use arrayfun for mp? I need to define a function in integral form. but integral only uses scalar values in its limits. If I use loops it would be a little slower.

0
Fixed

eigs() bug

Joe 4 years ago updated by Pavel Holoborodko 4 years ago 1

I noticed a pretty severe bug for the eigs() function. In particular, if I do:

A = sparse(mp(eye(4),34));
[evecs,evals] = eigs(A,1);


I expect an identity matrix to be returned for both evecs and evals, however, I get the following result after one call of the above code:

evecs = 

         0.6575264478049146996368762588811955    
         0.1350828341320901021606099191810989    
        0.09164029388649532440547542667314778    
         0.7355363042680420857014721043910981    


evals = 

    1


If I call it again I get an error:

Error using mp/subsref (line 1375)
Index exceeds matrix dimensions.

Error in mpeigs (line 523)
        D = ordeig(H(r,r));

Error in mp/eigs (line 3763)
            [varargout{1:nargout}] = mpeigs(varargin{:});


and in general it seems very sporadic, random, and most importantly, incorrect each time I call it. However, if I instead use the same function but without specifying the "1" as a parameter, e.g.:

A = sparse(mp(eye(4),34));
[evecs,evals] = eigs(A);


Everything seems to work as expected and I get identities returned for both evecs and evals. Obviously I don't need the eigenvalues and eigenvectors of the identity matrix but this is giving me little confidence in the eigenvectors and eigenvalues returned for the actual matrices I'm interested in. Am I missing something here or calling the function incorrectly? Also, I've noticed similar issues with the generalized eigenproblem equivalent of the above example.

Thank you.