MatFun

Applies a function to the specified dimensions of a matrix

https://github.com/Tetane/MatFun

You are now following this Submission

MATFUN Applies function to the specified dimensions of the matrix
A = MATFUN(FUN, MAT, DIM) applies the function specified by FUN to the dimensions DIM of the matrix MAT.
DIM is vector which maximum size is 3.

Example1:
A = rand(3,1000,1000);
% We want to compute the norm of the vector along the first dimension.
B = matfun(@norm, A, 1);
% B is a 1000x1000 matrix containing the norms of the vectors.

Example2:
A = rand(4,4,1000);
% We want apply the inverse function to all the 4x4 matrices
B = matfun(@inv, A, [1,2]);
% B is a 4x4x1000 matrix

Cite As

Stéphane Roussel (2026). MatFun (https://github.com/Tetane/MatFun), GitHub. Retrieved .

Categories

Find more on Linear Algebra in Help Center and MATLAB Answers

Tags

Add Tags

Add the first tag.

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux

Versions that use the GitHub default branch cannot be downloaded

Version Published Release Notes Action
1.0.1

New image

1.0.0

To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.