UnmarshalBinary unmarshals a binary representation of a Dense matrix.
(data []byte)
| 32 | |
| 33 | // UnmarshalBinary unmarshals a binary representation of a Dense matrix. |
| 34 | func (d *Dense[T]) UnmarshalBinary(data []byte) error { |
| 35 | switch any(T(0)).(type) { |
| 36 | case float32: |
| 37 | return d.unmarshalBinaryFloat32(data) |
| 38 | case float64: |
| 39 | return d.unmarshalBinaryFloat64(data) |
| 40 | default: |
| 41 | panic(fmt.Sprintf("mat: unexpected dense matrix type %T", T(0))) |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | func (d *Dense[T]) marshalBinaryFloat32() ([]byte, error) { |
| 46 | b := flatbuffers.NewBuilder(0) |