Revision as of 16:08, 29 September 2014 by Nathaniel
|Computes the inverse of a permutation|
|Other toolboxes required||none|
|Function category||Helper functions|
|This is a helper function that only exists to aid other functions in QETLAB. If you are an end-user of QETLAB, you likely will never have a reason to use this function.|
- PI = perm_inv(PERM)
- PERM: A vector containing a permutation of the integers 1, 2, ..., n.
The identity permutation is its own inverse:
To compute the inverse of the permutation on this MathWorld page, we can use the following line of code:
Click on "expand" to the right to view the MATLAB source code for this function.
%% PERM_INV Computes the inverse of a permutation
% This function has one required argument:
% PERM: a permutation vector
% PI = perm_inv(PERM) is the inverse permutation of PERM.
% URL: http://www.qetlab.com/perm_inv
% requires: nothing
% author: Nathaniel Johnston (firstname.lastname@example.org)
% package: QETLAB
% last updated: November 28, 2012
function res = perm_inv(perm)
[~,res] = sort(perm);