full — Convert sparse matrix storage to full storage.
A = full(S) converts a sparse double, single, or logical matrix to dense full storage. Inputs that are already full numeric, logical, character, complex, or gpuArray values are returned unchanged. RunMat also supports exact sparse integer value storage behind the independently gated full-integer-sparse extension.
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)converts sparse double, single, and logical values to dense values with the same class, row count, and column count.- Stored sparse values are materialized in column-major order and unstored entries become explicit zeros.
- Every already-full integer class passes through exactly on the host, while already-full resident integer values retain the same owning-provider handle without ambient-provider dispatch.
- In
runmatcompatibility mode, sparse matrices may carry any of the eight integer value classes andfulldensifies them without binary64 conversion; MATLAB-compatible modes reject this RunMat-only storage form before materialization. - 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.
Does full preserve integer classes?⌄
Yes. Already-full integer arrays are identity operations for all eight integer classes. RunMat can also densify exact sparse integer storage in runmat compatibility mode; that sparse integer representation is an explicitly gated extension because MATLAB sparse value storage is double, single, or logical.
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 · createArray · empty · eye · false · 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.