1

I'm working on a Finite element system based on Unity. I used CSparse.NET and Math.NET. I found that the bottleneck is matrix processing and computing, such as Multiply(), Get_Item() and CompressedColumnStorage.OfIndexed(). It means that matrix editing and computing is much slower than solving the linear system.

I want to make it faster but I have no idea in C#. I am able to transfer all data into C++ and employ Eigen to process matrices. But I don't know if it can be faster?

Evg
  • 25,259
  • 5
  • 41
  • 83
Albert Li
  • 31
  • 5
  • Interesting challenge. A lot of the optimizations are handled by the JIT compiler and there isn't much you can do, other than making sure you have localized memory access as much as possible, keeping needed data in the CPU cache. – John Alexiou Nov 27 '21 at 13:40
  • Thank you for your message. I have tried to use Eigen as my linear solver. And it works well in Windows Unity. But I don't know if this can run well on Mac or ios. Cheers – Albert Li Nov 27 '21 at 14:11
  • The bottleneck seems to be in the element addressing in `CSparse.NET` doubt there is much you can do there. – John Alexiou Nov 27 '21 at 15:47

1 Answers1

0

If you simply use an MxN array of (say) doubles, the multiplies are just a series of dot products (nested for loops work), not lightning-fast, but it has to be done. And gets are just array access x=M[m,n]. You could use your video card, they are designed to munch matricies.

  • Thank you for your reply. However, the same operations in MATLAB are very fast. I want to know how to improve my program as fast as MATLAB. Is it possible? Cheers – Albert Li Nov 27 '21 at 14:13