NativeQ4Matrix class final
A row-major rows, cols matrix in Q4 (Q4_0) in native memory.
- Implemented types
Constructors
- NativeQ4Matrix.fromGgufBlocks(Uint8List blocks, int rows, int cols)
-
Copies GGUF Q4_0 blocks without dequantizing or requantizing them.
Each block is a little-endian half scale followed by 16 nibble bytes.
factory
-
NativeQ4Matrix.fromPointers(int rows, int cols, Pointer<
Uint8> qs, Pointer<Uint16> scales) -
Wraps Q4 data in native memory:
qsholds rows * cols / 2 bytes,scalesrows * cols / 32 halves.factory - NativeQ4Matrix.quantize(Float32List w, int rows, int cols)
-
Quantizes float weights with llama.cpp's Q4_0 rule.
factory
Properties
- cols → int
-
final
- format → String
-
q8orq4.no setteroverride - hashCode → int
-
The hash code for this object.
no setterinherited
- qsBytes → Uint8List
-
The raw quantized values and scales, as written to the file.
no setteroverride
- rows → int
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scaleBytes → Uint8List
-
no setteroverride
Methods
-
apply(
Float32List xs, Float32List ys, int n, {bool? int8Inputs}) → void -
ys
t * rows + r= (W xst)rfor t < n, xs asn, cols.int8Inputsoverrides the process-wide setting (for tests).override -
free(
) → void -
Releases an owned allocation; mapped matrices must be closed via the cache.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
weightAt(
int r, int c) → double -
The weight the kernel uses at (r, c), for tests.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited