# go-cblas / tests / t1.go

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100``` ```package main import "fmt" import "cblas" func main() { { x := []float32{1., 2., 3.} fmt.Printf("x=%v\n", x) sumx := cblas.Sasum(x) fmt.Printf("sasum(x)=%v\n", sumx) } { x := []float64{1., 2., 3.} fmt.Printf("x=%v\n", x) sumx := cblas.Dasum(x) fmt.Printf("dasum(x)=%v\n", sumx) } { x := []complex64{complex(1., 1.), complex(2., 2.), complex(3., 3.)} fmt.Printf("x=%v\n", x) sumx := cblas.Scasum(x) fmt.Printf("scasum(x)=%v\n", sumx) } { x := []complex128{complex(1., 1.), complex(2., 2.), complex(3., 3.)} fmt.Printf("x=%v\n", x) sumx := cblas.Dzasum(x) fmt.Printf("dzasum(x)=%v\n", sumx) } { x := []float32{0.733} y := []float32{0.825} alpha := float32(0.) exp := float32(0.604725) val := cblas.Sdsdot(alpha, x, y) fmt.Printf("sdsdot: exp: %v\n", exp) fmt.Printf("sdsdot: val: %v\n", val) } { x := []complex128{complex(-0.87, -0.631)} y := []complex128{complex(-0.7, -0.224)} exp := complex128(complex(0.467656, 0.63658)) val := cblas.Zdotu(x, y) fmt.Printf("zdotu: exp: %v\n", exp) fmt.Printf("zdotu: val: %v\n", val) } return } /* #include int main (void) { int lda = 3; float A[] = { 0.11, 0.12, 0.13, 0.21, 0.22, 0.23 }; int ldb = 2; float B[] = { 1011, 1012, 1021, 1022, 1031, 1032 }; int ldc = 2; float C[] = { 0.00, 0.00, 0.00, 0.00 }; // Compute C = A B cblas_sgemm (CblasRowMajor, CblasNoTrans, CblasNoTrans, 2, 2, 3, 1.0, A, lda, B, ldb, 0.0, C, ldc); printf ("[ %g, %g\n", C[0], C[1]); printf (" %g, %g ]\n", C[2], C[3]); return 0; } // expected output: // [ 367.76, 368.12 // 674.06, 674.72 ] */ ```