Blame thirdparty/superlu/SuperLU_4.1/MATLAB/isperm.m
|
kusano |
7d535a |
function result = isperm(p)
|
|
kusano |
7d535a |
% ISPERM Is the argument a permutation?
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
result = 0;
|
|
kusano |
7d535a |
if min(size(p)) > 1, return, end;
|
|
kusano |
7d535a |
ds = diff(sort(p));
|
|
kusano |
7d535a |
if any(ds ~= 1), return, end;
|
|
kusano |
7d535a |
if min(p) ~= 1, return, end;
|
|
kusano |
7d535a |
result = 1;
|