https://github.com/pakallis/tdma
A Go package that solves a tridiagonal system of equations using the Tridiagonal matrix algorithm (TDMA)
https://github.com/pakallis/tdma
differential-equations equation-solver gauss-elimination linear-algebra matrix-decompositions matrix-factorization
Last synced: 5 months ago
JSON representation
A Go package that solves a tridiagonal system of equations using the Tridiagonal matrix algorithm (TDMA)
- Host: GitHub
- URL: https://github.com/pakallis/tdma
- Owner: pakallis
- License: mit
- Created: 2018-06-07T16:56:42.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-10T11:54:54.000Z (about 8 years ago)
- Last Synced: 2024-06-20T02:12:18.526Z (about 2 years ago)
- Topics: differential-equations, equation-solver, gauss-elimination, linear-algebra, matrix-decompositions, matrix-factorization
- Language: Go
- Homepage:
- Size: 2.93 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TDMA
A Go package that solves a tridiagonal system of equations using the Tridiagonal matrix algorithm (TDMA)
## Quick start
---
### Installation
```
go get -u github.com/pakallis/tdma/tdma
```
### Example Usage
1. Create file solve_tdma.go
```go
package main
import (
"fmt"
"github.com/pakallis/tdma/tdma"
)
func main() {
var l = []float64{0, -1, -1, -1}
var d = []float64{4, 4, 4, 4}
var u = []float64{-1, -1, -1, 0}
var b = []float64{5, 5, 10, 23}
result := tdma.Solve(l, d, u, b)
fmt.Println("Result:")
for i := 0; i < len(result); i++ {
fmt.Printf("%g ", result[i])
}
fmt.Println()
}
```
2. Run file with
```
go run solve_tdma.go
```
### Testing
```
cd tdma_test
go test
```