예제 #1
0
파일: p2.go 프로젝트: hacatu/project-euler
/* Calculates the appropriate power of the next-even transformation matrix
 * and returns the coefficients in the linear equation it represents.
 */
func calcTMat(n int) (aa, ab, ba, bb int) {
	t1Mat := mat64.NewDense(2, 2, []float64{3, 2, 2, 1})
	tMat := new(mat64.Dense)
	tMat.Pow(t1Mat, n)

	return round(tMat.At(0, 0)),
		round(tMat.At(0, 1)),
		round(tMat.At(1, 0)),
		round(tMat.At(1, 1))
}