permutationparity

Finds the parity of a permutation
439 download
Aggiornato 28 gen 2010

Visualizza la licenza

% permutationparity
% p = permutationparity(P,Dim)
%
% Returns the parity of a permutation. A value of 0 indicates an even
% permutation, while a value of 1 indicates an odd permutation.
%
% The parity of permutations with duplicate values cannot be determined
% with this routine.
%
% `Dim` specifies which dimension the permutations are located on.
% If Dim == 1 each column of the matrix `P` is treated as a permutation,
% If Dim == 2 each row of the matrix `P` is treated as a permutation.
% If Dim is empty or unspecified, if defaults to treating each column as
% a different permutation.
%
% Example
% P = [1 2 3 5 4]; % An odd permutation
% pP = permutationparity(P) % Get parity
% pP = 1
%
% P = [1 2 3 5 4; 1 2 4 5 3];
% pP = permutationparity(P,2)
% pP = 1
% 0
%
% P = [1 2 3; 3 1 2; 2 3 1]; % Rows are odd, columns are even
% pP = permutationparity(P,1)
% pP = 0 0 0
%
% pP = permutationparity(P,2)
% pP = 1
% 1
% 1
%
% See also
% permutationparity perms randperm
%

Cita come

Pierce Brady (2024). permutationparity (https://www.mathworks.com/matlabcentral/fileexchange/26514-permutationparity), MATLAB Central File Exchange. Recuperato .

Compatibilità della release di MATLAB
Creato con R2009b
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux
Categorie
Scopri di più su Elementary Math in Help Center e MATLAB Answers
Riconoscimenti

Ispirato: permn

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Versione Pubblicato Note della release
1.0.0.0