Description: Fix the short-circuit boolean operators
Author: Rafael Laboissiere <rafael@laboissiere.net>
Last-Update: 2012-03-31

--- octave-nnet-0.1.13.orig/inst/newff.m
+++ octave-nnet-0.1.13/inst/newff.m
@@ -176,7 +176,7 @@ function net = newff(Pr,ss,transFunc,tra
   function checkInputArgs(Pr,ss)
     
     ## check if Pr has correct format
-    if !isreal(Pr) | (size(Pr,2)!=2)
+    if !isreal(Pr) || (size(Pr,2)!=2)
       error("Input ranges must be a two column matrix!")
     endif
     if any(Pr(:,1) > Pr(:,2)) # check if numbers in the second column are larger as in the first one
@@ -192,7 +192,7 @@ function net = newff(Pr,ss,transFunc,tra
     endif
     for k=1:length(ss)
       sk = ss(k);
-      if !isreal(sk) | any(sk<1) | any(round(sk)!=sk)
+      if !isreal(sk) || any(sk<1) || any(round(sk)!=sk)
         error("Layer sizes is not a row vector of positive integers.")
       endif
     endfor
--- octave-nnet-0.1.13.orig/inst/isposint.m
+++ octave-nnet-0.1.13/inst/isposint.m
@@ -42,7 +42,7 @@ function f = isposint(n)
   endif
 
   f = 1;
-  if ( (!isreal(n)) | (n<=0) | (round(n) != n) )
+  if ( (!isreal(n)) || (n<=0) || (round(n) != n) )
     f = 0;
   endif
 
--- octave-nnet-0.1.13.orig/inst/__newnetwork.m
+++ octave-nnet-0.1.13/inst/__newnetwork.m
@@ -143,7 +143,7 @@ function net = __newnetwork(numInputs,nu
     error(nargchk(2,2,nargin))
 
     ## check type of arguments
-    if ( !isscalar(numLayers) | !isposint(numLayers) )
+    if ( !isscalar(numLayers) || !isposint(numLayers) )
       error("second argument must be a positive integer scalar value!")
     endif
     if ( !__checknetstruct(net) )
@@ -169,7 +169,7 @@ function net = __newnetwork(numInputs,nu
     error(nargchk(2,2,nargin))
 
     ## check type of arguments
-    if ( !isscalar(numLayers) | !isposint(numLayers) )
+    if ( !isscalar(numLayers) || !isposint(numLayers) )
       error("second argument must be a positive integer scalar value!")
     endif
     if ( !isstruct(net) )
--- octave-nnet-0.1.13.orig/inst/__trainlm.m
+++ octave-nnet-0.1.13/inst/__trainlm.m
@@ -231,7 +231,7 @@ function [net] = __trainlm(net,Im,Pp,Tt,
     endif
 
     ## goal can be zero or a positive double
-    if ( (goal<0) | !(isa(goal,"double")) )
+    if ( (goal<0) || !(isa(goal,"double")) )
       error("Goal is not zero or a positive real value.")
     endif
 
@@ -241,31 +241,31 @@ function [net] = __trainlm(net,Im,Pp,Tt,
       error("maxFail is not a positive integer.")
     endif
 
-    if (!isa(minGrad,"double")) | (!isreal(minGrad)) | (!isscalar(minGrad)) | \
+    if (!isa(minGrad,"double")) || (!isreal(minGrad)) || (!isscalar(minGrad)) || \
       (minGrad < 0)
       error("minGrad is not zero or a positive real value.")
     end
 
     ## mu must be a positive real value. this parameter is responsible
     ## for moving from stepest descent to quasi newton
-    if ((!isa(mu,"double")) | (!isreal(mu)) | (any(size(mu)) != 1) | (mu <= 0))
+    if ((!isa(mu,"double")) || (!isreal(mu)) || (any(size(mu)) != 1) || (mu <= 0))
       error("mu is not a positive real value.")
     endif
 
     ## muDec defines the decrement factor
-    if ((!isa(muDec,"double")) | (!isreal(muDec)) | (any(size(muDec)) != 1) | \
-  		 (muDec < 0) | (muDec > 1))
+    if ((!isa(muDec,"double")) || (!isreal(muDec)) || (any(size(muDec)) != 1) || \
+  		 (muDec < 0) || (muDec > 1))
       error("muDec is not a real value between 0 and 1.")
     endif
 
     ## muInc defines the increment factor
-    if (~isa(muInc,"double")) | (!isreal(muInc)) | (any(size(muInc)) != 1) | \
+    if (~isa(muInc,"double")) || (!isreal(muInc)) || (any(size(muInc)) != 1) || \
       (muInc < 1)
       error("muInc is not a real value greater than 1.")
     endif
 
     ## muMax is the upper boundary for the mu value
-    if (!isa(muMax,"double")) | (!isreal(muMax)) | (any(size(muMax)) != 1) | \
+    if (!isa(muMax,"double")) || (!isreal(muMax)) || (any(size(muMax)) != 1) || \
       (muMax <= 0)
       error("muMax is not a positive real value.")
     endif
@@ -283,7 +283,7 @@ function [net] = __trainlm(net,Im,Pp,Tt,
     endif
 
     ## check at last the time argument, must be zero or a positive real value
-    if (!isa(time,"double")) | (!isreal(time)) | (any(size(time)) != 1) | \
+    if (!isa(time,"double")) || (!isreal(time)) || (any(size(time)) != 1) || \
       (time < 0)
       error("Time is not zero or a positive real value.")
     end
@@ -301,7 +301,7 @@ function [net] = __trainlm(net,Im,Pp,Tt,
     error(nargchk(12,12,nargin));
 
     ## show progress
-    if isfinite(show) & (!rem(iEpochs,show) | length(stop))
+    if isfinite(show) && (!rem(iEpochs,show) || length(stop))
       fprintf(shortStr);   # outputs the training algorithm
       if isfinite(epochs)
         fprintf(", Epoch %g/%g",iEpochs, epochs);
