Learn R Programming

ggmlR (version 0.8.1)

ggml_matrix-class: 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 ggml_matrix,ANY
%*%(x, y)

# S4 method for ANY,ggml_matrix %*%(x, y)

# S4 method for ggml_matrix,ggml_matrix %*%(x, y)

# S4 method for ggml_matrix crossprod(x, y)

# S4 method for ggml_matrix tcrossprod(x, y)

# S4 method for ggml_matrix dim(x)

# S4 method for ggml_matrix show(object)

Value

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

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).

Slots

data

The underlying numeric matrix.

device

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

prec

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