ggml_out_prod: Outer Product (Graph)

View source: R/operations.R

ggml_out_prodR Documentation

Outer Product (Graph)

Description

Computes the outer product of two vectors: C = a * b^T For vectors a[m] and b[n], produces matrix C[m, n].

Usage

ggml_out_prod(ctx, a, b)

Arguments

ctx

GGML context

a

First vector tensor

b

Second vector tensor

Value

Matrix tensor representing the outer product

Examples


ctx <- ggml_init(16 * 1024 * 1024)
a <- ggml_new_tensor_1d(ctx, GGML_TYPE_F32, 3)
b <- ggml_new_tensor_1d(ctx, GGML_TYPE_F32, 4)
ggml_set_f32(a, c(1, 2, 3))
ggml_set_f32(b, c(1, 2, 3, 4))
c <- ggml_out_prod(ctx, a, b)  # Result: 3x4 matrix
graph <- ggml_build_forward_expand(ctx, c)
ggml_graph_compute(ctx, graph)
ggml_free(ctx)


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