7

For non sparse matrix m, is MatrixExp[m, v] supposed to be faster than MatrixExp[m].v? This seems to be true only if m is purely real or imaginary.

Block[{n = 500},
v = RandomComplex[1. + I, n];
s = RandomReal[{-1., 1.}, {n, n}];
s1 = RandomComplex[1. + I, {n, n}];
]

MatrixExp[s].v; // AbsoluteTiming

{0.12628, Null}

MatrixExp[s, v]; // AbsoluteTiming

{0.0379219, Null}

MatrixExp[s1].v; // AbsoluteTiming

{0.365637, Null}

MatrixExp[s1, v]; // AbsoluteTiming

{5.17002, Null}

MatrixExp[s1, v, Method -> "Krylov"]; // AbsoluteTiming

{4.93712, Null}

MatrixExp[s1, v, Method -> "Pade"]; // AbsoluteTiming

{0.416058, Null}

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
user64620
  • 581
  • 2
  • 11

1 Answers1

2

Mr.Wizard

Timing results in Mathematica 10.1.0 under Windows 7 x64:

{0.0660777, Null}

{0.0303608, Null}

{0.190943, Null}

{1.46382, Null}

{1.41635, Null}

{0.183233, Null}

So I confirm MatrixExp[s1, v] and MatrixExp[s1, v, Method -> "Krylov"] as being slower on my system.


Alexey Popkov

Timing results with Mathematica 10.4.1 under Windows 7 x64 (CPU with 2 physical cores):

{1.26094, Null}

{0.638639, Null}

{1.26434, Null}

{19.7368, Null}

{18.708, Null}

{1.89468, Null}


Mariusz Iwaniuk

Timing results with Mathematica 10.2.0 under Windows 8.1 x64 (CPU with 2 physical cores):

{1.03687, Null}

{0.128066, Null}

{3.9396, Null}

{21.1016, Null}

{21.0798, Null}

{3.95479, Null}


( Use this Community Wiki to share any other timing results of interest. )

Mariusz Iwaniuk
  • 13,841
  • 1
  • 25
  • 41
Mr.Wizard
  • 271,378
  • 34
  • 587
  • 1,371