class PackedMatrix Packed layout is not indexable — this is a data container for packed GEMM kernels.
- N-API path: buffer is a V8-managed ArrayBuffer, auto-freed by GC.
- WASM path: stores a heap pointer,
dispose()calls Module._free().
PackedMatrixOpaque packed matrix container.9class PackedMatrix Packed layout is not indexable — this is a data container for packed GEMM kernels.
dispose() calls Module._free().PackedMatrixnew PackedMatrix(
buffer: ArrayBuffer,
columns: number,
depth: number,
dtype: DType,
byteLength: number,
) disposedispose(): void toStringtoString(): string columnsreadonly columns: number depthreadonly depth: number dtypereadonly dtype: DType byteLengthreadonly byteLength: number bufferreadonly buffer: ArrayBuffer disposedreadonly disposed: boolean dotsPackedSizeQueries the packed buffer's byte count for a matrix with the given [columns,depth] and dtype, matching what dotsPack would allocate.function dotsPackedSize(
columns: number,
depth: number,
dtype: DType,
): number columnsnumber | Number of vectors being packed, the matrix rows. | |
|---|---|---|
depthnumber | Dimensionality per vector, the matrix columns. | |
dtypeDType | Element dtype of the source matrix. |
dotsPackPacks a Matrix for use with packed GEMM-like operations, such as dotsPacked.function dotsPack(matrix: Matrix): PackedMatrix matrixMatrix | The matrix to pack, [rows,columns] shaped. |
|---|
dotsPackedSize.dotsPackedComputes the dot products between every row of a and every packed vector in packed.function dotsPacked(
a: Matrix,
packed: PackedMatrix,
out?: Matrix,
): Matrix aMatrix | The query matrix, [rows,columns] shaped, columns matching packed's depth. | |
|---|---|---|
packedPackedMatrix | The packed matrix produced by dotsPack. | |
outMatrix | Optional output matrix to write into, [a.rows,packed.columns] shaped. |
out when given, otherwise a newly allocated Matrix.angularsPackedComputes the angular distances between every row of a and every packed vector in packed.function angularsPacked(
a: Matrix,
packed: PackedMatrix,
out?: Matrix,
): Matrix aMatrix | The query matrix, [rows,columns] shaped, columns matching packed's depth. | |
|---|---|---|
packedPackedMatrix | The packed matrix produced by dotsPack. | |
outMatrix | Optional output matrix to write into, [a.rows,packed.columns] shaped. |
out when given, otherwise a newly allocated Matrix.euclideansPackedComputes the Euclidean distances between every row of a and every packed vector in packed.function euclideansPacked(
a: Matrix,
packed: PackedMatrix,
out?: Matrix,
): Matrix aMatrix | The query matrix, [rows,columns] shaped, columns matching packed's depth. | |
|---|---|---|
packedPackedMatrix | The packed matrix produced by dotsPack. | |
outMatrix | Optional output matrix to write into, [a.rows,packed.columns] shaped. |
out when given, otherwise a newly allocated Matrix.dotsSymmetricComputes the all-pairs dot products between every row of vectors and every other row.function dotsSymmetric(
vectors: Matrix,
out?: Matrix,
options?: { rowsBegin?: number; rowsEnd?: number },
): Matrix vectorsMatrix | The matrix of vectors, [rows,columns] shaped. | |
|---|---|---|
outMatrix | Optional output matrix to write into, [vectors.rows,vectors.rows] shaped. | |
options{ rowsBegin?: number; rowsEnd?: number } | Optional row range: rowsBegin and rowsEnd restrict which rows of the
symmetric matrix are computed, defaulting to all rows. |
out when given, otherwise a newly allocated Matrix.angularsSymmetricComputes the all-pairs angular distances between every row of vectors and every other row.function angularsSymmetric(
vectors: Matrix,
out?: Matrix,
options?: { rowsBegin?: number; rowsEnd?: number },
): Matrix vectorsMatrix | The matrix of vectors, [rows,columns] shaped. | |
|---|---|---|
outMatrix | Optional output matrix to write into, [vectors.rows,vectors.rows] shaped. | |
options{ rowsBegin?: number; rowsEnd?: number } | Optional row range: rowsBegin and rowsEnd restrict which rows of the
symmetric matrix are computed, defaulting to all rows. |
out when given, otherwise a newly allocated Matrix.euclideansSymmetricComputes the all-pairs Euclidean distances between every row of vectors and every other row.function euclideansSymmetric(
vectors: Matrix,
out?: Matrix,
options?: { rowsBegin?: number; rowsEnd?: number },
): Matrix vectorsMatrix | The matrix of vectors, [rows,columns] shaped. | |
|---|---|---|
outMatrix | Optional output matrix to write into, [vectors.rows,vectors.rows] shaped. | |
options{ rowsBegin?: number; rowsEnd?: number } | Optional row range: rowsBegin and rowsEnd restrict which rows of the
symmetric matrix are computed, defaulting to all rows. |
out when given, otherwise a newly allocated Matrix.