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!')
|
error('compare_vectors:: First input argument must be one of the following function handles: @lt, @gt, @le or @ge!')
|
||||||
end
|
end
|
||||||
|
|
||||||
if feval(f, A(1), B(1))
|
if isequal(length(A),1)
|
||||||
C = 1;
|
if feval(f, A, B)
|
||||||
elseif isequal(A(1),B(1)) && length(A)>1
|
C = 1;
|
||||||
C = compare_vectors(f, A(2:end), B(2:end));
|
else
|
||||||
elseif isequal(A(1),B(1)) && isequal(length(A),1) && ismember(func2str(f),{'le', 'ge'})
|
C = 0;
|
||||||
C = 1;
|
end
|
||||||
else
|
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
|
end
|
||||||
|
|
||||||
%@test:1
|
%@test:1
|
||||||
|
|
Loading…
Reference in New Issue