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

NameTypeRequiredDefaultDescription
SAnyYesSparse or full matrix.

Returns

NameTypeDescription
AAnyFull matrix or already-full input.

Errors

IdentifierWhenMessage
RunMat:full:InvalidInputInput is not a sparse matrix or already-full matrix value.full: invalid input
RunMat:full:InternalSparse-to-full materialisation fails internally.full: internal error

How full works

  • full(S) converts SparseTensor values 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 dense m-by-n zero tensors.
  • Dense numeric tensors, scalar numeric/logical values, logical arrays, character arrays, complex arrays, and dense gpuArray handles 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.

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

Shape

blkdiag · cat · circshift · diag · flip · fliplr · flipud · horzcat · ipermute · kron · permute · repelem · repmat · reshape · rot90 · squeeze · toeplitz · tril · triu · vertcat

Indexing

find · ind2sub · sub2ind

Introspection

iscolumn · isempty · ismatrix · isrow · isscalar · isvector · length · ndims · numel · size

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how full is executed, line by line, in Rust.

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.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.