Matrix

TD COMPs / TOPs / 2023 – Present

In traditional image processing, matrices form the foundation of nearly every computation. Images are represented as two‐dimensional arrays of values — each pixel acting as a single cell within a numerical grid. Linear algebra operations such as addition, subtraction, multiplication, and convolution are applied directly to these arrays, manipulating pixel intensities to achieve transformations like filtering, blending, or feature extraction. In this sense, the matrix itself is the image.

The Matrix components in this collection reinterpret that convention. Instead of treating pixels as individual matrix elements, each cell in these matrices represent a complete image. This image‐level approach elevates matrix computation from numerical abstraction to visual structure, allowing operations such as determinant, trace, or multiplication to occur between entire textures rather than scalar values.

This methodology draws inspiration from the Harris and Hessian detectors, where multiple directional‐derivative images are arranged as matrix elements to compute measures of curvature and stability. Building on that principle, these components extend the language of matrix algebra into a spatial domain — where each operation produces meaningful, image‐based relationships between cells.

Together, they establish a framework for matrix operations that operate not just on images, but with them — combining the rigor of linear algebra with the expressive, procedural nature of TouchDesigner.

Index:
Determinant, Frobenius Norm, Linear Combination, Matrix Compiler, Matrix Visualizer, Multiplication, Scalar, Trace, Transpose

Determinant

Matrix Volume Operator

This component computes the determinant of the input matrix — a scalar measure of the input matrice’s overall magnitude or “volume.” In this implementation, each cell of the matrix represents a complete image, and the determinant is calculated by combining those image cells according to classical matrix algebra.

This implementation of the Determinant calculation requires a square matrix as input, meaning the number of rows and columns must be equal. This component supports matrices of sizes 2×2, 3×3, and 4×4 configurations. For each supported size, the determinant is expanded according to the appropriate minor and cofactor relationships, with pixel values calculated in parallel across all positions in the image.

Formally, the determinant of a Matrix (M) of size 2×2, is calculated as such:

| M | = | [ a b c d ] | = ad bc

Formally, the determinant of a Matrix (M) of size 3×3, is calculated as such:

| M | = | [ a b c d e f g h i ] | = aei + bfg + cdh ceg bdi afh

The resulting output is a single image whose pixel values represent the determinant computed at each coordinate — effectively collapsing the matrix into one image that encodes its cumulative spatial “response.” In practical workflows, this operation is fundamental to methods such as the Harris and Hessian detectors, where determinant values quantify local curvature, corner strength, or structural stability across an image.

Resources:

Download the .tox files
Matrix Determinant on Wikipedia

In‐ / Outputs

Input 0TOP matrix to be processed.

Output 0TOP calculated determinant of the input matrix.

Updated25/10/2025


Frobenius Norm

Matrix Magnitude Operator

This component calculates the Frobenius norm of the input matrix — a scalar measure of the matrix’s overall magnitude derived from the sum of the squares of its elements. In this implementation, each cell of the matrix represents a complete image, and the Frobenius norm is computed by evaluating the pixel‐wise squared intensities across all cells, then taking the square root of their cumulative sum.

Formally, the Frobenius norm of a Matrix (M) of size 2×2, is calculated as such:

M = [ a b c d ] = a2 + b2 + c2 + d2

The Frobenius norm thus collapses the matrix into a single output image of format 32‐bit float mono, where each pixel encodes the combined magnitude of that coordinate across all matrix cells.

This component is particularly useful for analyzing or normalizing the global strength of a matrix field — for instance, when comparing the relative magnitudes of image‐based matrices or measuring the total intensity response of multi‐channel transformations.

Resources:

Download the .tox files
Matrix norm on Wikipedia

In‐ / Outputs

Input 0TOP matrix to be processed.

Output 0TOP calculated Frobenius norm of the input matrix.

Updated26/10/2025


Linear Combination

Matrix Addition and Subtraction

This component performs element‐wise addition or subtraction between two matrices of identical dimensions. Each cell in the matrices represents a complete image, and during computation, corresponding cells are combined pixel by pixel according to the selected operation.
For the operation to be valid, both input matrices must have the same number of rows and columns, ensuring a one‐to‐one correspondence between their image cells.

Formally, the addition of two Matrices (M1 & M2) of size 2×2, is calculated as such:

M1 + M2 = [ a b c d ] 1 + [ e f g h ] 2 = [ a+e b+f c+g d+h ]

In practice, the Linear Combination COMP treats each image cell in the input matrices as a distinct operand. When set to Add, the component merges intensity and structure between matrices, effectively amplifying shared features or gradients. When set to Subtract, it emphasizes difference, contrast, or change between corresponding elements — making it useful for comparative analysis, change detection, or differential blending.

Resources:

Download the .tox files
Matrix Addition on Wikipedia
Matrix Subtraction Calculator

Parameters

Operation:

Specifies whether this component performs addition or subtraction between two input matrices.

In‐ / Outputs

Input 0TOP first matrix to be processed.

Input 1TOP second matrix to be processed.

Output 0TOP calculated combination of input matrices.

Updated25/10/2025


Matrix Compiler

2D Texture Array Matrix Assembly

This component constructs a matrix by compiling multiple image inputs (TOPs) into a structured 2D Texture Array. Unlike most TouchDesigner operators, the Matrix Compiler does not accept a single input connection. Instead, each cell within the matrix is populated by assigning a specific TOP to its corresponding Cell parameter.

The resulting matrix represents a spatially organized collection of images — where each image serves as one element of the matrix. This compiled array can then be passed to other Matrix COMPs for analytical or algebraic operations such as multiplication, determinant, or trace computation.

Formally, the compiled matrix (M) can be expressed as:

M = [ Ι11 Ι12 ... Ι1n Ι21 Ι22 ... Ι2n Ιm1 Ιm2 ... Ιmn ]

By formalizing the structure of matrices as a 2D Texture Array, the Matrix Compiler serves as the entry point for all matrix‐based operations within this system of components, bridging traditional matrix theory with image‐based computation.

Resources:

Download the .tox files
Matrices on Wikipedia

Parameters

Sample:

Specifies a TOP input whose resolution defines the base resolution for all matrix cells. This ensures that each image inserted into the matrix shares a consistent width and height.

Dimensions:

Sets the resolution manually when no TOP is assigned to the Sample parameter.

Matrix Dimensions:

Defines the size of the matrix in terms of its number of rows (Y) and columns (X).


Compile:

Rebuilds the matrix 2D texture array when triggered.
This is useful when the Texture 3D TOP encounters an error or displays incorrect layer assignments, ensuring that the compiled 2D texture array accurately reflects the user‐defined matrix structure.

Cell 0 – n:

References a TOP to be inserted into the corresponding matrix cell.

In‐ / Outputs

Output 0TOP compiled matrix.

Updated25/10/2025


Matrix Visualizer

2D Array Matrix Representation

Because matrices in this system are transmitted as 2D Texture Arrays, their spatial relationships can be difficult to interpret directly within TouchDesigner’s TOP viewer. The Matrix Visualizer reconstructs and displays these arrays in their true matrix configuration, restoring the visual organization of rows and columns that would otherwise be lost in transmission.

While it performs no mathematical operations, the Matrix Visualizer is an essential utility for verifying the structure and integrity of matrix inputs before applying analytical or procedural transformations.

Resources:

Download the .tox files

In‐ / Outputs

Input 0TOP matrix to be visualized.

Output 0TOP unaltered input matrix.

Updated25/10/2025


Multiplication

Matrix Product Operator

This component performs the matrix multiplication between two image matrices. Each cell in both input matrices represents a complete image, and multiplication is carried out by combining these image cells according to classical matrix algebra — with all pixel values evaluated in parallel.

For matrix multiplication to be valid, the number of columns in the first matrix must equal the number of rows in the second matrix. The resulting matrix adopts the row count of the first input and the column count of the second, with each output cell formed by the sum of pixel‐wise products between corresponding image pairs.

Formally, the multiplication of two Matrices (M1 & M2) of size 2×2, is calculated as such:

M1 M2 = [ a b c d ] 1 [ e f g h ] 2 = [ ae + bg af + bh ce + dg cf + dh ]

This implementation allows the principles of matrix algebra to be extended to the image domain, enabling the synthesis of spatially dependent operations such as directional correlation, structural energy computation, or higher‐order field construction.

Each term represents a per‐pixel multiplication between corresponding image cells, followed by a summation of those products. The resulting output matrix therefore consists of images whose pixel values encode the full row‐by‐column interactions of the original matrices.

Resources:

Download the .tox files
Matrix Multiplication on Wikipedia

In‐ / Outputs

Input 0TOP firsts matrix to be processed.

Input 1TOP second matrix to be processed.

Output 0TOP calculated product of the two input Matrices.

Updated25/10/2025


Scalar

Per‐Cell Multiplicative Adjustment

This component multiplies every pixel in each matrix cell by a uniform scalar value. Each cell represents a complete image within the compiled matrix, and the Scalar parameter applies the same floating‐point multiplier across all of them, preserving the relative structure of the matrix while uniformly adjusting image intensity. Pre‐Add and Post‐Add uniformly add or subtract a user‐defined value before or after multiplication, allowing for fine control over image brightness and contrast.

Resources:

Download the .tox files
Scalar on Wikipedia

Parameters

Pre‐Add:

Defines a value added uniformly to every cell in the input matrix before multiplication.

Scalar:

Defines a scalar value applied uniformly to every cell in the input matrix. Each element of the matrix is multiplied by this float value, scaling the entire matrix proportionally.

Post‐Add:

Defines a value added uniformly to every cell in the input matrix after multiplication.

In‐ / Outputs

Input 0TOP matrix to be processed.

Output 0TOP scaled matrix.

Updated26/10/2025


Trace

Diagonal Summation Operator

This component computes the sum of all images along the input matrix’s principal diagonal. Each diagonal cell contributes its pixel values directly to the final output, producing a single composite image that represents the cumulative intensity or structure along the matrix’s diagonal.

Formally, for a Matrix (M) of size 3×3, its trace is calculated as such:

Tr (M) = i=1 n M ii = a+e+i

Where (M) is defined as:

M = [ a b c d e f g h i ]

While the input is a full matrix composed of multiple image cells, the output is a collapsed single image. This operation effectively reduces the dimensionality of the matrix, translating multi‐cell relationships into a unified spatial field.

This component is a particularly useful tool for summarizing complex matrix interactions in a single visual result.

Resources:

Download the .tox files
Matrix Trace on Wikipedia

In‐ / Outputs

Input 0TOP matrix to be processed.

Output 0TOP calculated trace of the input matrix.

Updated25/10/2025


Transpose

Matrix Cell Reorientation

This component swaps the rows and columns of the input matrix, producing its transposed form. Each cell represents a complete image, and during transposition, the position of each image is mirrored across the matrix’s diagonal.

Formally, the transpose of a Matrix (M) is defined as:

MT ( i,j ) = M ( j,i )

For example:

M = [ a b c d e f g h i ] , MT = [ a d g b e h c f i ]

While the pixel content of each image remains unchanged, the spatial organization of the matrix is restructured. This makes the Transpose COMP particularly useful for operations where the order of matrix elements influences subsequent computations, such as in multiplication, determinant, or trace workflows.

Resources:

Download the .tox files
Matrix Transposition on Wikipedia

In‐ / Outputs

Input 0TOP matrix to be processed.

Output 0TOP transposed matrix.

Updated25/10/2025