Skip to content
/ tdma Public

A Go package that solves a tridiagonal system of equations using the Tridiagonal matrix algorithm (TDMA)

License

Notifications You must be signed in to change notification settings

pakallis/tdma

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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
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()
}
  1. Run file with
go run solve_tdma.go

Testing

cd tdma_test
go test

About

A Go package that solves a tridiagonal system of equations using the Tridiagonal matrix algorithm (TDMA)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages