Chapter 4

weights — FormatNone MatVec

github.com/openfluke/welvet/weights


Why it exists

Unquantized matrices still need a typed store that streams MatVec without forcing a float32 master or Morph-as-training.

What it is

Store holds DType + Format + Native/Packed bytes. New[T], MatVec, MatVecT, DecodeRow, SelectWire (F32/F64/I8). Dense and composite projs call this for FormatNone.

Go example

examples/04-weights/main.go

Run:cd welvet/examples/04-weights && source ../env.sh && go run .
package main

import (
	"fmt"

	"github.com/openfluke/welvet/core"
	"github.com/openfluke/welvet/quant"
	"github.com/openfluke/welvet/weights"
)

func main() {
	s, err := weights.New[float32](2, 2, []float32{1, 0, 0, 1}, core.DTypeFloat32, quant.FormatNone)
	if err != nil {
		panic(err)
	}
	y := make([]float32, 2)
	if err := weights.MatVec(s, []float32{3, 4}, y); err != nil {
		panic(err)
	}
	fmt.Println(y) // ≈ [3, 4]
}

Output

exit 0 · last run via go run .

[3 4]