Reference contents

Two containers for one system

A dense matrix preallocates n² cells. Triplet assembly reserves linear arrays for element contributions only.

Step 1 of 5

Element chain and global degrees of freedom

Select a member: its four coefficients will be highlighted in both representations.

Full system matrix

Easy to read, but memory is also allocated for every zero.

81 cells

MKE-F sparse assembly

Linear buffers → combine addresses → sparse matrix.

32 contributions
1

DOF map and ndgrid

dofsglobal element DOFs
elementRows(:)row numbers
elementColumns(:)column numbers
stiffness(:)stiffness coefficients

One color links the row, column and value of one triplet. A 2 × 2 matrix produces four address pairs.

2

Triplets before summation

Select an element in the chain
globalK = sparse(rows, columns, stiffnessValues, n, n);

GNU Octave’s library function accepts coordinates and values, sums entries sharing an address and creates a sparse matrix of the specified size.

3

After sparse()

unique addresses
duplicates summed
fill
Two full matrices K and M
n² numbers per matrix, including zeros.
Current assembly buffers
rows, columns, K values and M values; four entries per 2 × 2 element matrix.
Nonzero K and M values
Excludes internal Octave index metadata.

sparse() constructs the matrix but does not solve the system

After assembly, a sparse matrix behaves like an ordinary matrix: extract Kff, multiply by a vector or pass it to the standard solve operator. Octave recognizes sparse storage and selects appropriate numerical algorithms without requiring you to recreate a square array of zeros.

Static system

The first DOF is fixed and the last is loaded. Only the free part is solved.

u(freeDOFs) = Kff \ Ff