gitee.com/quant1x/num@v0.3.2/matrix_test.go (about) 1 package num 2 3 import ( 4 "fmt" 5 "testing" 6 ) 7 8 func TestConcat1D(t *testing.T) { 9 a := []int{1, 2, 3, 4, 5} 10 b := Mul(a, a) 11 c := []int{1, 1, 1, 1, 1} 12 fmt.Println(Concat1D[int](b, a, c)) 13 } 14 15 func TestTranspose2D(t *testing.T) { 16 N := 5 17 x := Arange[float64](1, float64(N)+1, 1) 18 19 t1 := Pow[float64](x, 2) 20 t2 := x 21 t3 := Ones[float64](x) 22 23 A := Concat1D(t1, t2, t3) 24 T := Transpose2D(A) 25 fmt.Println("A =", A) 26 fmt.Println("T =", T) 27 }