GPUDevice from init()
'lower' to use the lower triangle, 'upper' to use the upper triangle
order of the matrix A (number of rows and columns)
scalar multiplier for A*x
Float64Array, row-major or column-major (see layout), at least (n-1)*lda+n elements
leading dimension of A (>= n either way — A is square)
Float64Array input vector, length at least (n-1)*incx+1
stride for x (must be a positive integer)
scalar multiplier for y
Float64Array input/output vector, length at least (n-1)*incy+1
stride for y (must be a positive integer)
Optionallayout: "column-major" | "row-major"
storage layout of A (default: 'row-major'); for a symmetric
matrix, column-major storage just means the other triangle is the one
physically referenced for a given uplo
Performs the symmetric matrix-vector operation $$y \leftarrow \alpha A x + \beta y$$ in double precision (double-double emulation).
x and y are kept resident on the GPU. A must be a GpuMatrix (Float64Array-
backed); its own layout (set at GpuMatrix.from time) determines the
operation — there is no separate layout argument here.
import { init, cleanup } from "wgblas";
import { dsymv } from "wgblas/dsymv";
import { GpuVector } from "wgblas/classes/GpuVector";
import { GpuMatrix } from "wgblas/classes/GpuMatrix";
const device = await init();
// Only the upper triangle is read; the zeros below stand for the mirrored 1s.
const n = 3;
const A = new Float64Array([2, 1, 0, 0, 2, 1, 0, 0, 2]);
const x = new Float64Array([1, 1, 1]);
const AGpu = GpuMatrix.from(A, n, n, n, "row-major");
const xGpu = GpuVector.from(x);
const yGpu = GpuVector.from(new Float64Array(n));
console.log("A (upper triangle stored) =");
console.table([A.slice(0, 3), A.slice(3, 6), A.slice(6, 9)]);
console.log("x =", x);
await dsymv(device, "upper", n, 1, AGpu, AGpu.lda, xGpu, 1, 0, yGpu, 1);
// Implied full matrix [[2,1,0],[1,2,1],[0,1,2]] -> row sums
console.log("y = A*x =", await yGpu.read()); // [3, 4, 3]
AGpu.destroy();
xGpu.destroy();
yGpu.destroy();
if (typeof process !== "undefined") cleanup();
GPUDevice from init()
'lower' to use the lower triangle, 'upper' to use the upper triangle
order of the matrix A
scalar multiplier for A*x
GpuMatrix (Float64Array-backed), GPU-resident
leading dimension of A (must equal A.lda)
GpuVector input vector (Float64Array-backed, not mutated)
stride for x (must be a positive integer)
scalar multiplier for y
GpuVector input/output vector (Float64Array-backed, mutated in place)
stride for y (must be a positive integer)
Performs the symmetric matrix-vector operation $$y \leftarrow \alpha A x + \beta y$$ in double precision (double-double emulation — WGSL has no native f64 type).
A is an n×n symmetric matrix stored in row-major order. Only the triangle specified by
uplois referenced; the other triangle is inferred by symmetry.Browser (standalone HTML):