ggml_matrix-class: A GPU-backed matrix wrapper

ggml_matrix-classR Documentation

A GPU-backed matrix wrapper

Description

An S4 class holding an ordinary numeric matrix, tagged so that %*%, crossprod() and tcrossprod() run on the GPU (see ggml_matmul). Wrap a matrix with as_gpu_matrix.

Usage

## S4 method for signature 'ggml_matrix,ANY'
x %*% y

## S4 method for signature 'ANY,ggml_matrix'
x %*% y

## S4 method for signature 'ggml_matrix,ggml_matrix'
x %*% y

## S4 method for signature 'ggml_matrix'
crossprod(x, y)

## S4 method for signature 'ggml_matrix'
tcrossprod(x, y)

## S4 method for signature 'ggml_matrix'
dim(x)

## S4 method for signature 'ggml_matrix'
show(object)

Arguments

x, y

Operands; at least one is a ggml_matrix (the other is coerced with as.matrix). For crossprod/tcrossprod, y may be missing.

object

A ggml_matrix (for the show method).

Value

%*%, crossprod and tcrossprod return a plain numeric matrix (the GPU result); dim an integer vector.

Slots

data

The underlying numeric matrix.

device

Dispatch preference: "auto", "gpu" or "cpu".

prec

Precision of the GPU path: "f32" or "f16".


ggmlR documentation built on July 14, 2026, 1:08 a.m.