# Improve possible vtkMath bottleneck

**URL:** https://discourse.vtk.org/t/improve-possible-vtkmath-bottleneck/8913
**Category:** Development
**Created:** [July 9, 2022, 1:05pm UTC](https://discourse.vtk.org/t/improve-possible-vtkmath-bottleneck/8913 "2022-07-09T13:05:34Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mau\_igna\_06](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mau_igna_06/32/8064_2.png) [@mau\_igna\_06](https://discourse.vtk.org/u/mau_igna_06)
#### Post date: [July 9, 2022, 1:05pm UTC](https://discourse.vtk.org/t/improve-possible-vtkmath-bottleneck/8913/1 "2022-07-09T13:05:34Z")

</div>

Hi.

While using Slicer with VerySleepy I noticed it spent a lot of time on `vtkJacobiN`. I did a quick search and there is a faster convergence algorithm called GaussSeidel.

You can see more here:

> **[chap\_10\_2.pdf](https://college.cengage.com/mathematics/larson/elementary_linear/5e/students/ch08-10/chap_10_2.pdf)**
>
> 123.72 KB

I implemented it, built Slicer and used it, and the change doesn’t appear to break anything…

> <https://github.com/mauigna06/VTK/commit/f330f7a16128fec9aa2edc0d612cbf72446ad060>

I leave it to VTK experts to make benchmarks of how much it improves… According to the book of the link I posted:

> GaussSeidel 5 iterations have the same accuracy than Jacobi 7 iterations.

---

<div class="post-metadata">

### Author: ![will.schroeder](https://discourse.vtk.org/user_avatar/discourse.vtk.org/will.schroeder/32/233_2.png) [@will.schroeder](https://discourse.vtk.org/u/will.schroeder)
#### Post date: [July 9, 2022, 2:05pm UTC](https://discourse.vtk.org/t/improve-possible-vtkmath-bottleneck/8913/2 "2022-07-09T14:05:23Z")

</div>

Fantastic thanks for doing this work. I’m on vacation the next couple of weeks but I’m sure someone will take a look soon.

---

<div class="post-metadata">

### Author: ![mau\_igna\_06](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mau_igna_06/32/8064_2.png) [@mau\_igna\_06](https://discourse.vtk.org/u/mau_igna_06)
#### Post date: [July 18, 2022, 5:13pm UTC](https://discourse.vtk.org/t/improve-possible-vtkmath-bottleneck/8913/3 "2022-07-18T17:13:18Z")

</div>

I have looked at this more in depth, I was wrong, there are no visible improvements… Sorry for the buzz… I’ll attach some profiling I did later

BTW: the algorithm for diagonalization has the same name as the algorithm for solving linear equations that confused me at first.
