I am writing a Tridiagonal solver using c++. I know that they exist already, but I want to go through the motions for the sake of learning. I am a novice C++ user, however, even before I start writing the program, I get the feeling that the manner in which I am going to write it is not the best way. This is how I was about to start my function, but I want some input on alternative ways to do this.(adsbygoogle = window.adsbygoogle || []).push({});

Code (Text):

void triSolve(double oUp[],double oLow[], double oMain[],

double oRHS[], int n, double soln[])

{

// Thomas' Algorithm starts here

return;

}

where:

oUp[] = upper diagonal of tridiagonal system

oLow[] = lower diagonal of tridiagonal system

oMain[] = Main diagonal of tridiagonal system

n = size of system

oRHS[] = right hand side of tridiagonal system

soln[] = solution to the problem

As you can see, this function returns nothing; it modifies the value of the solution vector in the main() program by replacing its contents with the contents of the formal parameter soln[]. I feel like this isn't the best way. Should I instead try toreturnthe solution vector to the main program?

What are your thoughts?

**Physics Forums - The Fusion of Science and Community**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# C++: Tridiagonal Solver

Loading...

Similar Threads - Tridiagonal Solver | Date |
---|---|

Sudoku Solver Problem | Mar 30, 2017 |

Any advice on PDE solvers? | Jun 18, 2016 |

Resources for programming math solvers in Python | Jul 28, 2015 |

Numerical second order pde solver | Sep 1, 2014 |

Eigenvalues of a tridiagonal matrix | Dec 28, 2007 |

**Physics Forums - The Fusion of Science and Community**