func MatrixT(M, Omega, Sigma *mx.DenseMatrix, n int) func() (T *mx.DenseMatrix) { checkMatrixT(M, Omega, Sigma, n) fmt.Println("M:", M) fmt.Println("Sigma:", Sigma) fmt.Println("Omega:", Omega) p := M.Rows() m := M.Cols() OmegaInv, err := Omega.Inverse() if err != nil { panic(err) } Sdist := Wishart(n+p-1, OmegaInv) Xdist := MatrixNormal(mx.Zeros(p, m), mx.Eye(p), Sigma) return func() (T *mx.DenseMatrix) { S := Sdist() Sinv, err := S.Inverse() if err != nil { panic(err) } Sinvc, err := Sinv.Cholesky() if err != nil { panic(err) } X := Xdist() fmt.Println("Sinvc:", Sinvc) fmt.Println("X:", X) T, err = Sinvc.Transpose().TimesDense(X) if err != nil { panic(err) } err = T.AddDense(M) if err != nil { panic(err) } return } }
func main() { fmt.Println(mat.Eye(3)) }