full — Convert sparse matrix storage to full storage.
A = full(S) converts a RunMat sparse double matrix to dense full storage. Inputs that are already full numeric, logical, character, complex, or gpuArray values are returned unchanged.
Syntax
A = full(S)Inputs
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
S | Any | Yes | — | Sparse or full matrix. |
Returns
| Name | Type | Description |
|---|---|---|
A | Any | Full matrix or already-full input. |
Errors
| Identifier | When | Message |
|---|---|---|
RunMat:full:InvalidInput | Input is not a sparse matrix or already-full matrix value. | full: invalid input |
RunMat:full:Internal | Sparse-to-full materialisation fails internally. | full: internal error |
How full works
full(S)convertsSparseTensorvalues to dense double tensors with the same row and column shape.- Stored sparse values are materialized in column-major order and unstored entries become explicit zeros.
- Empty sparse matrices such as
sparse(m,n)become densem-by-nzero tensors. - Dense numeric tensors, scalar numeric/logical values, logical arrays, character arrays, complex arrays, and dense
gpuArrayhandles pass through unchanged. - Cells, structs, strings, objects, function handles, symbolic expressions, classes, and exceptions raise
RunMat:full:InvalidInput.
GPU memory and residency
Already-full GPU tensors remain on the GPU. Sparse host matrices are converted to host dense tensors.
Examples
Convert sparse storage to a full matrix
S = sparse([1; 3; 2], [1; 1; 2], [10; 30; 20], 3, 2);
A = full(S)Expected output:
A = [10 0; 0 20; 30 0]Empty sparse matrices become dense zeros
S = sparse(2, 3);
A = full(S)Expected output:
A = [0 0 0; 0 0 0]Already-full arrays remain full
A = full([1 0; 0 2])Expected output:
A = [1 0; 0 2]Using full with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how full changes the result.
Run a small full example, explain the result, then change one input and compare the output.
FAQ
Does full change matrix values?⌄
No. It changes sparse storage into dense storage while preserving shape and values. Unstored sparse entries become explicit zeros.
Does full gather dense gpuArray values?⌄
No. Dense gpuArray handles are already full, so RunMat returns the existing GPU handle unchanged.
Can full create native sparse GPU output?⌄
No. RunMat's current sparse matrices are host-resident, and full only materializes them as host dense tensors.
Related Array functions
Creation
colon · eye · false · fill · inf · linspace · logspace · magic · meshgrid · nan · nchoosek · ndgrid · nonzeros · ones · peaks · perms · rand · randi · randn · randperm · range · sparse · spdiags · speye · spones · sprand · true · zeros
Grouping
accumarray · combinations · discretize · findgroups · groupcounts · grp2idx · splitapply
Sorting Sets
argsort · intersect · ismember · ismembertol · issorted · issortedrows · setdiff · setxor · sort · sortrows · union · unique
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how full is executed, line by line, in Rust.
- View the source for full in Rust on GitHub
- Learn how the RunMat runtime works
- Found a bug? Open an issue with a minimal reproduction.
About RunMat
RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 license.
- RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
- Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.