Skip to content

iemmatrix

A collection of Pure Data objects for manipulating simple matrices. Its functionality includes matrix arithmetic and optional higher-mathematics, FFT, and sound-file operations when supporting libraries are available.

Contributors

People who contribute to this project.

Objects

  • mtx_.cabs2 mtx_.cabs2 computes the element-wise absolute value of a complex-valued matrix and outputs a real-valued matrix.
  • mtx_.cdiv mtx_.cdiv performs element-wise division of two complex-valued matrices.
  • mtx_.cmul mtx_.cmul performs element-wise multiplication of two complex-valued matrices.
  • mtx_abs mtx_abs computes the absolute value of each element in an input matrix and outputs the resulting matrix.
  • mtx_add mtx_add performs matrix addition, either adding two matrices or adding a scalar offset to a matrix.
  • mtx_and mtx_and performs logical AND operations on matrices.
  • mtx_atan mtx_atan computes the arc tangent of each element in an input matrix and outputs the resulting matrix.
  • mtx_atan2 mtx_atan2 computes the arctangent (atan2) element-wise for matrix data and outputs a matrix.
  • mtx_bessel mtx_bessel calculates Bessel functions for the elements of an input matrix and outputs matrix results.
  • mtx_binops mtx_binops represents iemmatrix’s binary matrix arithmetic objects for addition, subtraction, matrix or element-wise multiplication, element-wise division, and element-wise power.
  • mtx_bitand mtx_bitand performs matrix logic using bitwise AND, either between two matrices or between a matrix and a scalar.
  • mtx_bitleft mtx_bitleft performs a bitwise left shift on a matrix.
  • mtx_bitor mtx_bitor performs matrix logic using bitwise OR, either between two matrices or between a matrix and a scalar.
  • mtx_bitright mtx_bitright performs a bitwise right shift on matrix elements.
  • mtx_cabs2 mtx_cabs2 computes the absolute value of a complex-valued matrix and outputs a real-valued matrix.
  • mtx_cart2sph mtx_cart2sph converts a matrix of Cartesian vectors into spherical coordinates.
  • mtx_cholesky mtx_cholesky decomposes an input matrix using Cholesky's algorithm and outputs the result as a matrix.
  • mtx_cinverse mtx_cinverse computes the inverse of a complex-valued matrix.
  • mtx_circular_harmonics mtx_circular_harmonics evaluates circular harmonics at points specified by phi coordinates, producing a matrix suitable for uses such as 2D Ambisonic encoding.
  • mtx_cmul mtx_cmul performs multiplication of two complex-valued matrices, with each matrix supplied as separate real and imaginary parts.
  • mtx_col mtx_col sets columns of a matrix, either a selected column or all columns.
  • mtx_colon mtx_colon is a matrix colon operator that creates ascending row-vector sequences from start, stop, and increment values, similar to Octave.
  • mtx_concat mtx_concat concatenates two input matrices into a new matrix, either column-wise by default or row-wise.
  • mtx_conv mtx_conv performs two-dimensional convolution of an input matrix with a filter-matrix kernel, providing 2D FIR filtering and outputting the resulting matrix.
  • mtx_convolver~ mtx_convolver~ performs multi-input, multi-output signal convolution using a uniformly partitioned convolution matrix with output cross-fading.
  • mtx_cos mtx_cos computes the cosine of each element in an input matrix and outputs the resulting matrix.
  • mtx_cumprod mtx_cumprod computes the cumulative product of a matrix in either the row or column direction, which can be used to calculate factorials or geometric series.
  • mtx_cumsum mtx_cumsum computes the cumulative sum of a matrix in the row or column direction, making it useful for numerical integration or generating ascending number sequences.
  • mtx_dbtopow mtx_dbtopow converts each element of an input matrix from Pd-style dB values to power values.
  • mtx_dbtorms mtx_dbtorms converts each element of an input matrix from Pd-style dB values to linear RMS values.
  • mtx_diag mtx_diag creates a diagonal matrix and can also extract the diagonal of an input matrix.
  • mtx_diegg mtx_diegg creates a turned diagonal (anti-diagonal) matrix and can obtain the turned diagonal of an input matrix.
  • mtx_diff mtx_diff calculates forward or backward differences between matrix elements, making it useful for numerical derivatives of vectors and matrices.
  • mtx_distance mtx_distance calculates the Euclidean distance matrix between two sets of vectors supplied as matrices, with each row defining a vector of the same dimension.
  • mtx_distance2 mtx_distance2 calculates a matrix of squared Euclidean distances between two sets of vectors, with each input matrix’s rows representing vectors of the same dimension.
  • mtx_egg mtx_egg creates an exchange matrix, described as a turned identity matrix.
  • mtx_eig mtx_eig computes the complex-valued eigenvalues of an input matrix and, when requested, its eigenvectors.
  • mtx_element mtx_element sets elements of a matrix and outputs the resulting matrix.
  • mtx_eq mtx_eq compares a matrix for equality with another matrix or with a scalar, outputting a matrix.
  • mtx_exp mtx_exp computes the exponential of each element in an input matrix and outputs the resulting matrix.
  • mtx_eye mtx_eye creates an identity matrix for control-rate matrix processing.
  • mtx_fft mtx_fft computes the forward complex-valued FFT of each row of an input matrix, producing real and imaginary output matrices with the same dimensions.
  • mtx_fill mtx_fill fills elements from one matrix into specified positions of another matrix.
  • mtx_fill_col_grid mtx_fill_col_grid fills supplied matrix or vector values into specified column indices of a given matrix, producing a matrix containing the inserted values.
  • mtx_fill_row_grid mtx_fill_row_grid fills values into specified row indices of a given matrix and outputs the matrix containing the inserted values.
  • mtx_fill_rowcol mtx_fill_rowcol fills values into a matrix at specified row and column indices, outputting the resulting matrix.
  • mtx_fill_rowcol_grid mtx_fill_rowcol_grid fills a given matrix with supplied values at the grid positions defined by row and column indices, and outputs the resulting matrix.
  • mtx_find mtx_find finds the indices of nonzero elements in an input matrix and outputs them as a matrix, or an empty matrix when none exist.
  • mtx_find_rowcol mtx_find_rowcol calculates the row and column indices of nonzero elements in an input matrix or vector.
  • mtx_gauss mtx_gauss applies Gaussian elimination, using row and column transformations to shape an input matrix into an upper-triangular matrix.
  • mtx_ge mtx_ge compares a matrix with another matrix for greater-than logic and outputs a matrix.
  • mtx_gt mtx_gt performs an element-wise greater-than comparison between two matrices or between a matrix and a scalar, producing a matrix result.
  • mtx_ifft mtx_ifft computes the complex-valued inverse FFT of each row of an input matrix, producing a matrix with the same dimensions.
  • mtx_index mtx_index addresses matrix elements by their indices, allowing multiple known elements to be selected simultaneously; its output matrix has the same shape as the indexing matrix.
  • mtx_index2rowcol mtx_index2rowcol converts a matrix or vector of linear matrix indices into separate matrices of row and column indices, compatible with indices used by objects such as mtx_find, mtx_index, and mtx_fill.
  • mtx_index_col_grid mtx_index_col_grid finds values at specified column-grid indices in a given matrix and outputs a matrix containing the indexed columns.
  • mtx_index_row_grid mtx_index_row_grid finds values at specified row-grid indices in a given matrix and outputs a matrix containing the indexed rows.
  • mtx_index_rowcol mtx_index_rowcol retrieves values from a matrix at given row/column indices and outputs a matrix containing those indexed values.
  • mtx_index_rowcol_grid mtx_index_rowcol_grid retrieves values at a grid of row and column indices from a given matrix.
  • mtx_int mtx_int computes the integer value of each element in an input matrix and outputs the resulting matrix.
  • mtx_inverse mtx_inverse calculates the inverse of a square matrix, for which multiplying the input and inverse in either order yields the identity matrix.
  • mtx_isequal mtx_isequal compares a matrix with another matrix or a scalar and outputs a float indicating whether all elements are equal.
  • mtx_ispeak mtx_ispeak searches each row of an input matrix or vector for peaks, outputting a logical matrix or vector with peak locations set to 1 and all other locations set to 0.
  • mtx_ispeakb mtx_ispeakb searches each row of an input matrix or vector for peaks and outputs a matrix or vector with 1 at peak locations and 0 elsewhere.
  • mtx_le mtx_le performs an element-wise less-than-or-equal comparison, either between two matrices or between a matrix and a scalar, and outputs a matrix.
  • mtx_linspace mtx_linspace creates a linearly spaced matrix vector from a start value to a stop value with a specified number of entries.
  • mtx_linsweep mtx_linsweep creates an n-sample linear sweep matrix spanning specified start and stop digital frequencies.
  • mtx_log mtx_log computes the natural logarithm of each element in an input matrix and outputs the resulting matrix.
  • mtx_logspace mtx_logspace creates a logarithmically spaced matrix vector from a start value to a stop value with a specified number of entries.
  • mtx_logsweep mtx_logsweep creates a matrix vector containing an n-sample logarithmic sweep between specified starting and stopping digital frequencies.
  • mtx_lt mtx_lt performs element-wise less-than comparisons, comparing one matrix with another matrix or with a scalar and outputting a matrix.
  • mtx_matcher mtx_matcher tries to match two sets of vectors, with each set represented as a matrix.
  • mtx_max2 mtx_max2 computes the element-wise maximum of two matrices, serving as the matrix equivalent of max.
  • mtx_mean mtx_mean calculates the mean value of each column in an input matrix for matrix statistics.
  • mtx_meshgrid mtx_meshgrid creates X and Y grid matrices from x- and y-tick vectors, producing all (x, y) value pairs.
  • mtx_min2 mtx_min2 computes the element-wise minimum of two matrices, for matrix comparison at control rate.
  • mtx_minmax mtx_minmax finds the minimum and maximum values of an input matrix.
  • mtx_mul mtx_mul performs matrix multiplication and outputs the resulting matrix.
  • mtx_mul~ mtx_mul~ multiplies a set of input signals by a gain matrix to produce a set of output signals, enabling matrix-based signal routing and mixing.
  • mtx_neq mtx_neq compares a matrix with another matrix or with a scalar for inequality and outputs a matrix.
  • mtx_not mtx_not performs element-wise logical inversion of an input matrix and outputs the resulting matrix.
  • mtx_ones mtx_ones creates a matrix in which every element is 1.
  • mtx_or mtx_or performs logical OR operations on matrices.
  • mtx_pack~ mtx_pack~ packs signal vectors from multiple inputs—usually 64 samples each—into a matrix containing all channels from all input signals.
  • mtx_phon_curve mtx_phon_curve calculates a phon curve at frequencies supplied as a row or column matrix, outputting the corresponding curve values in dB.
  • mtx_pinverse mtx_pinverse calculates the inverse of a square matrix using pivoting.
  • mtx_pivot mtx_pivot pivot-transforms a matrix by rearranging its rows and columns so that maximum values lie on the diagonal, with the matrix maximum at the upper-left corner.
  • mtx_plot mtx_plot displays a matrix as a plot, clipping values to the range 0 (black) to 1 (white), with optional table-based colormaps.
  • mtx_polyval mtx_polyval evaluates a polynomial with given coefficients at specified values of x.
  • mtx_pow mtx_pow calculates the power function for each element of a matrix, performing element-wise matrix arithmetic.
  • mtx_powtodb mtx_powtodb converts each power value in an input matrix to Pd-style decibels and outputs a matrix.
  • mtx_print mtx_print prints an incoming matrix to the console in a formatted way.
  • mtx_prod mtx_prod computes the column-wise product of a matrix and outputs the products as a list.
  • mtx_qr mtx_qr calculates the QR decomposition of an input matrix using GSL, producing matrices Q and R such that A = Q * R.
  • mtx_rand mtx_rand fills a matrix with random values in the range (0, 1].
  • mtx_randperm mtx_randperm generates a random permutation matrix for control-rate matrix processing.
  • mtx_repmat mtx_repmat repeats an incoming matrix vertically and horizontally to form a larger meta-matrix.
  • mtx_resize mtx_resize resizes an incoming matrix to a specified number of rows and columns, then outputs the resized matrix.
  • mtx_reverse mtx_reverse reverses the order of a matrix’s columns, rows, or individual elements.
  • mtx_rfft mtx_rfft computes a real-valued FFT independently for each row of an input matrix, producing real and imaginary result matrices with N/2+1 columns.
  • mtx_rifft mtx_rifft computes a real-valued inverse FFT independently for each matrix row.
  • mtx_rmstodb mtx_rmstodb converts each element of a matrix from a linear RMS value to Pd-style decibels.
  • mtx_roll mtx_roll shifts the columns of an input matrix and outputs the resulting matrix.
  • mtx_roots mtx_roots solves polynomials using eigenvalues via mtx_eig, accepting a matrix of polynomial coefficients such as 1 -2 4 -12 -45 54.
  • mtx_rot mtx_rot produces a two-dimensional Cartesian rotation matrix for use in matrix-based control processing.
  • mtx_rotx mtx_rotx creates a three-dimensional Cartesian rotation matrix for rotation around the x-axis.
  • mtx_roty mtx_roty produces a three-dimensional Cartesian rotation matrix for rotation around the y-axis.
  • mtx_rotz mtx_rotz creates a 3D Cartesian rotation matrix for rotation around the z-axis.
  • mtx_row mtx_row sets rows of a matrix and outputs the resulting matrix.
  • mtx_scroll mtx_scroll shifts the rows of an input matrix and outputs the resulting matrix.
  • mtx_sfread mtx_sfread reads rows from a multichannel sound file and outputs them as a matrix.
  • mtx_sfwrite mtx_sfwrite writes the rows of an input matrix to a multichannel sound file.
  • mtx_show mtx_show displays an input matrix, with its display size adjusting automatically to the matrix dimensions and required digits.
  • mtx_sin mtx_sin calculates the sine of each element in an input matrix and outputs the resulting matrix.
  • mtx_size mtx_size reports the size of an input matrix.
  • mtx_slice mtx_slice extracts a specified section from an input matrix and can be used to partition matrices.
  • mtx_sndfileread mtx_sndfileread reads multichannel data from a sound file into a matrix.
  • mtx_sph2cart mtx_sph2cart converts spherical coordinates to Cartesian coordinates in matrix form.
  • mtx_spherical_harmonics mtx_spherical_harmonics evaluates spherical harmonics at points supplied as azimuth and zenith coordinates in a 2×L input matrix, producing an output matrix whose columns are ordered by k=n²+n+m+1.
  • mtx_spherical_harmonics_rotator mtx_spherical_harmonics_rotator computes a Wigner-D rotation matrix for rotating spherical harmonics.
  • mtx_spherical_radial mtx_spherical_radial calculates spherical radials from a matrix of coordinates and outputs the result as a matrix.
  • mtx_spivot mtx_spivot permutes a matrix’s rows so that maximum or minimum values lie on the diagonal, although the diagonal remains unsorted.
  • mtx_sqrt mtx_sqrt calculates the square root of each element in an input matrix and outputs the resulting matrix.
  • mtx_sub mtx_sub performs matrix arithmetic subtraction, either subtracting one matrix from another or subtracting an offset from a matrix.
  • mtx_sum mtx_sum computes the column-wise sum of an input matrix and outputs the sums as a list.
  • mtx_svd mtx_svd computes the singular value decomposition of an input matrix using GSL, expressing it as A = U * S * V^T.
  • mtx_symasym mtx_symasym decomposes a square matrix M into symmetric and asymmetric parts such that M = S + A.
  • mtx_tab mtx_tab is a matrix object that uses a Pd table for local or global storage of its data.
  • mtx_tan mtx_tan computes the tangent of each element in an input matrix and outputs the resulting matrix.
  • mtx_trace mtx_trace calculates the trace of an input matrix, defined as the sum of its diagonal elements.
  • mtx_transpose mtx_transpose transposes a matrix, exchanging its rows and columns.
  • mtx_unpack~ mtx_unpack~ unpacks an incoming matrix into signal vectors, with one signal outlet per channel.
  • mtx_window mtx_window creates a matrix row vector containing a window function, specified by a window type and length.
  • mtx_zeros mtx_zeros creates a matrix whose elements are all zero.