changeset 17307:4448cc742880

Use '!' not operator rather than '~' in core m-files. * scripts/general/interp1.m, scripts/image/rgb2ind.m, scripts/plot/findobj.m, scripts/polynomial/polyfit.m, test/build-sparse-tests.sh, test/classes/@Snork/end.m, test/classes/@Snork/mpower.m, test/classes/@Snork/ne.m, test/classes/@Snork/power.m, test/classes/@Snork/subsasgn.m, test/classes/@Snork/subsref.m, test/classes/@Spork/loadobj.m, test/classes/classes.tst: Use '!' not operator rather than '~' in core m-files.
author Rik <rik@octave.org>
date Wed, 21 Aug 2013 17:04:44 -0700
parents 09543e9c8f40
children 5a6caf617f56
files scripts/general/interp1.m scripts/image/rgb2ind.m scripts/plot/findobj.m scripts/polynomial/polyfit.m test/build-sparse-tests.sh test/classes/@Snork/end.m test/classes/@Snork/mpower.m test/classes/@Snork/ne.m test/classes/@Snork/power.m test/classes/@Snork/subsasgn.m test/classes/@Snork/subsref.m test/classes/@Spork/loadobj.m test/classes/classes.tst
diffstat 13 files changed, 33 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/general/interp1.m	Wed Aug 21 16:42:13 2013 -0700
+++ b/scripts/general/interp1.m	Wed Aug 21 17:04:44 2013 -0700
@@ -191,7 +191,7 @@
   endif
 
   if ((rightcontinuous && (x(end) < x(1)))
-      || (~ rightcontinuous && (x(end) > x(1))))
+      || (! rightcontinuous && (x(end) > x(1))))
     ## Switch between left-continuous and right-continuous
     x = flipud (x);
     y = flipud (y);
--- a/scripts/image/rgb2ind.m	Wed Aug 21 16:42:13 2013 -0700
+++ b/scripts/image/rgb2ind.m	Wed Aug 21 17:04:44 2013 -0700
@@ -167,7 +167,7 @@
   ## Conversion of rgb image to x,map
   pr = prod (sz(1:end-1));
   x = zeros (sz(1:end-1));
-  [map,~,x(:)] = unique (reshape(rgb, [pr, 3]), "rows");
+  [map,~,x(:)] = unique (reshape (rgb, [pr, 3]), "rows");
 
   ## a colormap is of class double and values between 0 and 1
   switch (class (rgb))
--- a/scripts/plot/findobj.m	Wed Aug 21 16:42:13 2013 -0700
+++ b/scripts/plot/findobj.m	Wed Aug 21 17:04:44 2013 -0700
@@ -190,7 +190,7 @@
   endwhile
 
   numpairs = np - 1;
-  if (~ isempty (logicaloperator))
+  if (! isempty (logicaloperator))
     logicaloperator = shift (logicaloperator, 1);
   endif
 
--- a/scripts/polynomial/polyfit.m	Wed Aug 21 16:42:13 2013 -0700
+++ b/scripts/polynomial/polyfit.m	Wed Aug 21 17:04:44 2013 -0700
@@ -115,7 +115,7 @@
   p = r \ (q' * y);
   p(k) = p;
   
-  if (n ~= m)
+  if (n != m)
     q = p; p = zeros (n+1, 1); 
     p(polymask) = q;
   endif
@@ -140,9 +140,9 @@
       C = NaN * ones (m+1, m+1);
     end_try_catch
 
-    if (n ~= m)
+    if (n != m)
       ## fill matrices if required
-      s.X(:, ~polymask) = 0;
+      s.X(:, !polymask) = 0;
       s.R = zeros (n+1, n+1); s.R(polymask, polymask) = r;
       s.C = zeros (n+1, n+1); s.C(polymask, polymask) = C;
     else
--- a/test/build-sparse-tests.sh	Wed Aug 21 16:42:13 2013 -0700
+++ b/test/build-sparse-tests.sh	Wed Aug 21 17:04:44 2013 -0700
@@ -325,7 +325,7 @@
 %!test
 %! sv = as.^bf;
 %! fv = af.^bf;
-%! idx = find (af~=0);
+%! idx = find (af!=0);
 %! assert (sv(:)(idx), sparse (fv(:)(idx)), 100*eps)
 
 EOF
@@ -342,7 +342,7 @@
 %!test
 %! sv = as.^bs;
 %! fv = af.^bf;
-%! idx = find (af~=0);
+%! idx = find (af!=0);
 %! assert(sv(:)(idx), sparse (fv(:)(idx)), 100*eps)
 
 EOF
@@ -577,11 +577,11 @@
 %!assert (issparse (as.'))
 %!assert (issparse (as'))
 %!assert (issparse (-as))
-%!assert (~as, sparse (~af))
+%!assert (!as, sparse (!af))
 %!assert (as.', sparse (af.'));
 %!assert (as',  sparse (af'));
 %!assert (-as, sparse (-af));
-%!assert (~as, sparse (~af));
+%!assert (!as, sparse (!af));
 %!error [i,j] = size (af);as(i-1,j+1);
 %!error [i,j] = size (af);as(i+1,j-1);
 %!test
@@ -1204,7 +1204,7 @@
 gen_section
 gen_save_tests
 gen_section
-echo '%!test bf = bf+1i*(bf~=0);' >> $TESTS
+echo '%!test bf = bf+1i*(bf!=0);' >> $TESTS
 gen_rectangular_tests
 gen_section
 
@@ -1242,7 +1242,7 @@
 echo '%! as = sparse (af);' >> $TESTS
 gen_square_tests
 gen_section
-echo '%!test bf = bf+1i*(bf~=0);' >> $TESTS
+echo '%!test bf = bf+1i*(bf!=0);' >> $TESTS
 echo '%! bs = sparse (bf);' >> $TESTS
 gen_square_tests
 gen_section
--- a/test/classes/@Snork/end.m	Wed Aug 21 16:42:13 2013 -0700
+++ b/test/classes/@Snork/end.m	Wed Aug 21 17:04:44 2013 -0700
@@ -1,6 +1,6 @@
 function r = end (snk, index_pos, num_indices)
 
-  if (num_indices ~= 1)
+  if (num_indices != 1)
     error ('Snork object may only have one index')
   end
 
--- a/test/classes/@Snork/mpower.m	Wed Aug 21 16:42:13 2013 -0700
+++ b/test/classes/@Snork/mpower.m	Wed Aug 21 17:04:44 2013 -0700
@@ -1,6 +1,6 @@
 function s = mpower (s1, x)
 
-  if (~isa (s1, 'Snork') || isa (x, 'Snork'))
+  if (!isa (s1, 'Snork') || isa (x, 'Snork'))
     error ('mpower Snork!!!');
   end
 
--- a/test/classes/@Snork/ne.m	Wed Aug 21 16:42:13 2013 -0700
+++ b/test/classes/@Snork/ne.m	Wed Aug 21 17:04:44 2013 -0700
@@ -1,5 +1,5 @@
 function b = ne (s1, s2)
 
-  b = ~(s1 == s2);
+  b = !(s1 == s2);
 
 end
--- a/test/classes/@Snork/power.m	Wed Aug 21 16:42:13 2013 -0700
+++ b/test/classes/@Snork/power.m	Wed Aug 21 17:04:44 2013 -0700
@@ -1,6 +1,6 @@
 function s = power (s1, x)
 
-  if (~isa (s1, 'Snork') || isa (x, 'Snork'))
+  if (!isa (s1, 'Snork') || isa (x, 'Snork'))
     error ('power Snork!!!');
   end
 
--- a/test/classes/@Snork/subsasgn.m	Wed Aug 21 16:42:13 2013 -0700
+++ b/test/classes/@Snork/subsasgn.m	Wed Aug 21 17:04:44 2013 -0700
@@ -6,7 +6,7 @@
   switch (s(1).type)
     case '()'
       ind = s(1).subs;
-      if (numel (ind) ~= 1)
+      if (numel (ind) != 1)
         error ('Snork: need exactly one index');
       else
         if (length (s) == 1)
@@ -17,7 +17,7 @@
       end
     case '{}'
       ind = s(1).subs;
-      if (numel (ind) ~= 1)
+      if (numel (ind) != 1)
         error ('Snork: need exactly one index');
       else
         if (length (s) == 1)
--- a/test/classes/@Snork/subsref.m	Wed Aug 21 16:42:13 2013 -0700
+++ b/test/classes/@Snork/subsref.m	Wed Aug 21 17:04:44 2013 -0700
@@ -6,14 +6,14 @@
   switch (s(1).type)
     case '()'
       ind = s(1).subs;
-      if (numel (ind) ~= 1)
+      if (numel (ind) != 1)
         error ('Snork: need exactly one index');
       else
         b = snk.cack(ind{1});
       end
     case '{}'
       ind = s(1).subs;
-      if (numel (ind) ~= 1)
+      if (numel (ind) != 1)
         error ('Snork: need exactly one index');
       else
         b = snk.cack(ind{1});
--- a/test/classes/@Spork/loadobj.m	Wed Aug 21 16:42:13 2013 -0700
+++ b/test/classes/@Spork/loadobj.m	Wed Aug 21 17:04:44 2013 -0700
@@ -1,7 +1,7 @@
 function out = loadobj (in)
 
   out = in;
-  if (~isa (in, 'Spork'))
+  if (!isa (in, 'Spork'))
     out.cack = [];
   end
 
--- a/test/classes/classes.tst	Wed Aug 21 16:42:13 2013 -0700
+++ b/test/classes/classes.tst	Wed Aug 21 17:04:44 2013 -0700
@@ -59,9 +59,9 @@
 %! assert (isobject (snk));
 %! assert (isequal (class (snk), 'Snork'));
 %! assert (isa (snk, 'Snork'));
-%! assert (~isa (snk, 'Sneetch'));
+%! assert (!isa (snk, 'Sneetch'));
 %! assert (ismethod (snk, 'gick'));
-%! assert (~ismethod (snk, 'bletch'));
+%! assert (!ismethod (snk, 'bletch'));
 %! assert (exist ('snk') == 1);
 %! assert (exist ('blink') == 0);
 %!test snk1 = Snork (snk);
@@ -272,17 +272,17 @@
 %!assert (s1 == s1)
 %!assert (s1 == x1)
 %!assert (x1 == s1)
-%!assert (~(s1 == (s1 + 1)))
-%!assert (~(s1 == (x1 + 1)))
-%!assert (~(x1 == (s1 + 1)))
+%!assert (!(s1 == (s1 + 1)))
+%!assert (!(s1 == (x1 + 1)))
+%!assert (!(x1 == (s1 + 1)))
 
-%% Test overloaded ne (~=) for the Snork class
-%!assert (~(s1 ~= s1))
-%!assert (~(s1 ~= x1))
-%!assert (~(x1 ~= s1))
-%!assert (s1 ~= (s1 + 1))
-%!assert (x1 ~= (s1 + 1))
-%!assert (s1 ~= (x1 + 1))
+%% Test overloaded ne (!=) for the Snork class
+%!assert (!(s1 != s1))
+%!assert (!(s1 != x1))
+%!assert (!(x1 != s1))
+%!assert (s1 != (s1 + 1))
+%!assert (x1 != (s1 + 1))
+%!assert (s1 != (x1 + 1))
 
 %% Test overloaded lt (<) for the Snork class
 %!assert (s1 < (s1 + 1))