Untitled

mail@pastecode.io avatar
unknown
golang
2 months ago
456 B
1
Indexable
Never
import (
	"fmt"
	"math/rand"
	"time"

	"gonum.org/v1/gonum/mat"
)

func main() {

	rows := 3000
	cols := 3000

	data := make([]float64, rows*cols)

	for i := range data {
		data[i] = rand.Float64()
	}

	mat1 := mat.NewDense(rows, cols, data)

	for i := range data {
		data[i] = rand.Float64()
	}

	mat2 := mat.NewDense(rows, cols, data)

	start := time.Now()

	var mat3 mat.Dense

	mat3.Mul(mat1, mat2)

	fmt.Println("time taken = ", time.Since(start))

}
Leave a Comment