GPUDevice from init()
number of elements (must be a positive integer)
Float64Array input/output vector
stride for x (must be a positive integer)
Float64Array input/output vector
stride for y (must be a positive integer)
5-element Float64Array: [flag, h11, h21, h12, h22] flag = -2: identity (no-op), -1: full H, 0: unit diagonal, 1: unit off-diagonal
Applies a modified Givens plane rotation H to double-precision vectors x and y: $$\begin{pmatrix} x \\ y \end{pmatrix} \leftarrow \begin{pmatrix} h_{11} & h_{12} \\ h_{21} & h_{22} \end{pmatrix} \begin{pmatrix} x \\ y \end{pmatrix}$$ — GPU-resident overload; see the Float64Array overload above for the routine itself.
import { init, cleanup } from "wgblas";
import { drotm } from "wgblas/drotm";
import { daxpy } from "wgblas/daxpy";
import { GpuVector } from "wgblas/classes/GpuVector";
const device = await init();
const n = 5;
const xCpu = new Float64Array([1, 2, 3, 4, 5]);
const yCpu = new Float64Array([10, 20, 30, 40, 50]);
const xGpu = GpuVector.from(xCpu);
const yGpu = GpuVector.from(yCpu);
console.log("x (cpu): ", xCpu);
console.log("y (cpu): ", yCpu);
// flag = 0: unit diagonal — H = [ 1 h12 ] = [ 1 1 ]
// [ h21 1 ] [ 2 1 ]
const param = new Float64Array([0, 1, 2, 1, 1]);
// shift y by adding 2*x on GPU, then apply modified rotation
await daxpy(device, n, 2.0, xGpu, 1, yGpu, 1);
await drotm(device, n, xGpu, 1, yGpu, 1, param);
console.log("x (after): ", await xGpu.read());
console.log("y (after): ", await yGpu.read());
xGpu.destroy();
yGpu.destroy();
if (typeof process !== "undefined") cleanup();
GPUDevice from init()
number of elements (must be a positive integer)
GpuVector input/output vector (must be Float64Array-backed, mutated in place)
stride for x (must be a positive integer)
GpuVector input/output vector (must be Float64Array-backed, mutated in place)
stride for y (must be a positive integer)
5-element Float64Array: [flag, h11, h21, h12, h22] flag = -2: identity (no-op), -1: full H, 0: unit diagonal, 1: unit off-diagonal
Applies a modified Givens plane rotation H to double-precision vectors x and y: $$\begin{pmatrix} x \\ y \end{pmatrix} \leftarrow \begin{pmatrix} h_{11} & h_{12} \\ h_{21} & h_{22} \end{pmatrix} \begin{pmatrix} x \\ y \end{pmatrix}$$ — double-double (Dekker) f64 emulation of srotm, since WGSL has no native f64 type.
Browser (standalone HTML):