Changed logic in the routine performing lexicographic comparison of vectors.
parent
be32e645af
commit
6fff2fe75b
|
@ -42,14 +42,20 @@ if ~ismember(func2str(f),{'lt', 'gt', 'le', 'ge'})
|
|||
error('compare_vectors:: First input argument must be one of the following function handles: @lt, @gt, @le or @ge!')
|
||||
end
|
||||
|
||||
if feval(f, A(1), B(1))
|
||||
C = 1;
|
||||
elseif isequal(A(1),B(1)) && length(A)>1
|
||||
C = compare_vectors(f, A(2:end), B(2:end));
|
||||
elseif isequal(A(1),B(1)) && isequal(length(A),1) && ismember(func2str(f),{'le', 'ge'})
|
||||
C = 1;
|
||||
if isequal(length(A),1)
|
||||
if feval(f, A, B)
|
||||
C = 1;
|
||||
else
|
||||
C = 0;
|
||||
end
|
||||
else
|
||||
C = 0;
|
||||
if feval(f, A(1), B(1))
|
||||
C = 1;
|
||||
elseif isequal(A(1),B(1))
|
||||
C = compare_vectors(f, A(2:end), B(2:end));
|
||||
else
|
||||
C = 0;
|
||||
end
|
||||
end
|
||||
|
||||
%@test:1
|
||||
|
|
Loading…
Reference in New Issue