Loading ...
Sorry, an error occurred while loading the content.

marf-cvs Digest, Vol 24, Issue 1

Expand Messages
  • mokhov@cs.concordia.ca
    Send marf-cvs mailing list submissions to marf-cvs@lists.sourceforge.net To subscribe or unsubscribe via the World Wide Web, visit
    Message 1 of 1 , Jun 17, 2012
    • 0 Attachment
      Send marf-cvs mailing list submissions to
      marf-cvs@...

      To subscribe or unsubscribe via the World Wide Web, visit
      https://lists.sourceforge.net/lists/listinfo/marf-cvs
      or, via email, send a message with subject or body 'help' to
      marf-cvs-request@...

      You can reach the person managing the list at
      marf-cvs-owner@...

      When replying, please edit your Subject line so it is more specific
      than "Re: Contents of marf-cvs digest..."


      The MARF CVS Commit Log Digest
      Dispatched daily or when the size reaches 40k
      ----------------------------------------------

      Today's Topics:

      1. marf/src/marf/Preprocessing/WaveletFilters
      WaveletFilter.java, 1.5, 1.6 (Serguei A. Mokhov)
      2. marf/src/marf/math Algorithms.java,1.15,1.16 (Serguei A. Mokhov)
      3. marf/src/marf/junit/math - New directory (Serguei A. Mokhov)
      4. marf/src/marf/junit/math Algorithms.java,NONE,1.1
      (Serguei A. Mokhov)
      5. marf/src/marf/Preprocessing/WaveletFilters
      WaveletFilter.java, 1.6, 1.7 (Serguei A. Mokhov)
      6. marf/src/marf/math Algorithms.java,1.16,1.17 (Serguei A. Mokhov)
      7. marf .classpath,1.6,1.7 (Serguei A. Mokhov)
      8. marf/src/marf/math Algorithms.java,1.17,1.18 (Serguei A. Mokhov)
      9. marf/src/marf/junit/math Algorithms.java,1.1,1.2
      (Serguei A. Mokhov)
      10. marf/src/marf/Classification ClassificationFactory.java, 1.5,
      1.6 (Serguei A. Mokhov)


      ----------------------------------------------------------------------

      Message: 1
      Date: Sun, 03 Jun 2012 03:32:15 +0000
      From: "Serguei A. Mokhov" <mokhov@...>
      Subject: [marf-cvs] marf/src/marf/Preprocessing/WaveletFilters
      WaveletFilter.java, 1.5, 1.6
      To: marf-cvs@...
      Message-ID:
      <mailman.9816.1339960351.23886.marf-cvs@...>

      Update of /cvsroot/marf/marf/src/marf/Preprocessing/WaveletFilters
      In directory vz-cvs-4.sog:/tmp/cvs-serv9802/marf/Preprocessing/WaveletFilters

      Modified Files:
      WaveletFilter.java
      Log Message:
      Correct a few bugs, and start adding comments while review the code.


      Index: WaveletFilter.java
      ===================================================================
      RCS file: /cvsroot/marf/marf/src/marf/Preprocessing/WaveletFilters/WaveletFilter.java,v
      retrieving revision 1.5
      retrieving revision 1.6
      diff -C2 -d -r1.5 -r1.6
      *** WaveletFilter.java 30 May 2012 16:05:06 -0000 1.5
      --- WaveletFilter.java 3 Jun 2012 03:32:12 -0000 1.6
      ***************
      *** 106,110 ****

      //Arrays.copy(padFiltered, 0, adFiltered);
      ! Arrays.copy(padFiltered, 0, adFiltered, 0, padFiltered.length <= adFiltered.length ? padFiltered.length : adFiltered.length);

      Debug.debug(getClass(), "done");
      --- 106,117 ----

      //Arrays.copy(padFiltered, 0, adFiltered);
      ! Arrays.copy
      ! (
      ! padFiltered,
      ! 0,
      ! adFiltered,
      ! 0,
      ! padFiltered.length <= adFiltered.length ? padFiltered.length : adFiltered.length
      ! );

      Debug.debug(getClass(), "done");




      ------------------------------

      Message: 2
      Date: Sun, 03 Jun 2012 03:32:15 +0000
      From: "Serguei A. Mokhov" <mokhov@...>
      Subject: [marf-cvs] marf/src/marf/math Algorithms.java,1.15,1.16
      To: marf-cvs@...
      Message-ID:
      <mailman.9817.1339960351.23886.marf-cvs@...>

      Update of /cvsroot/marf/marf/src/marf/math
      In directory vz-cvs-4.sog:/tmp/cvs-serv9802/marf/math

      Modified Files:
      Algorithms.java
      Log Message:
      Correct a few bugs, and start adding comments while review the code.


      Index: Algorithms.java
      ===================================================================
      RCS file: /cvsroot/marf/marf/src/marf/math/Algorithms.java,v
      retrieving revision 1.15
      retrieving revision 1.16
      diff -C2 -d -r1.15 -r1.16
      *** Algorithms.java 19 Dec 2011 05:17:09 -0000 1.15
      --- Algorithms.java 3 Jun 2012 03:32:13 -0000 1.16
      ***************
      *** 406,409 ****
      --- 406,410 ----
      /**
      * <p>A collection of Wavelet-transform-related algorithms.</p>
      + * Code translated into Java from http://eeweb.poly.edu/iselesni/WaveletSoftware.
      * @author Serguei Mokhov
      * @since 0.3.0.6, November 2011
      ***************
      *** 411,415 ****
      public static final class Wavelet
      {
      ! // http://eeweb.poly.edu/iselesni/WaveletSoftware/allcode/farras.m
      public static double[][] af =
      {
      --- 412,420 ----
      public static final class Wavelet
      {
      ! /**
      ! * Analysis filters.
      ! * 2-rows 1-column, as opposed to 2-columns 1-row in MATLAB.
      ! * http://eeweb.poly.edu/iselesni/WaveletSoftware/allcode/farras.m
      ! */
      public static double[][] af =
      {
      ***************
      *** 440,449 ****
      };

      ! // http://eeweb.poly.edu/iselesni/WaveletSoftware/allcode/farras.m
      public static double[][] sf =
      {
      {
      ! 0,
      ! 0,
      -0.08838834764832,
      0.08838834764832,
      --- 445,457 ----
      };

      ! /**
      ! * Synthesis filters.
      ! * http://eeweb.poly.edu/iselesni/WaveletSoftware/allcode/farras.m
      ! */
      public static double[][] sf =
      {
      {
      ! 0.01122679215254,
      ! 0.01122679215254,
      -0.08838834764832,
      0.08838834764832,
      ***************
      *** 452,469 ****
      0.08838834764832,
      -0.08838834764832,
      ! 0.01122679215254,
      ! 0.01122679215254
      },
      {
      ! -0.01122679215254,
      ! 0.01122679215254,
      ! 0.08838834764832,
      ! 0.08838834764832,
      ! -0.69587998903400,
      ! 0.69587998903400,
      -0.08838834764832,
      -0.08838834764832,
      ! 0,
      ! 0
      }
      };
      --- 460,477 ----
      0.08838834764832,
      -0.08838834764832,
      ! 0,
      ! 0
      },
      {
      ! 0,
      ! 0,
      -0.08838834764832,
      -0.08838834764832,
      ! 0.69587998903400,
      ! -0.69587998903400,
      ! 0.08838834764832,
      ! 0.08838834764832,
      ! 0.01122679215254,
      ! -0.01122679215254
      }
      };
      ***************
      *** 482,486 ****
      }

      ! // http://eeweb.poly.edu/iselesni/WaveletSoftware/allcode/afb.m
      public static double[][] afb(double[] x, double[][] af)
      throws MathException
      --- 490,501 ----
      }

      ! /**
      ! * Analysis filter bank.
      ! * http://eeweb.poly.edu/iselesni/WaveletSoftware/allcode/afb.m
      ! * @param x
      ! * @param af
      ! * @return
      ! * @throws MathException
      ! */
      public static double[][] afb(double[] x, double[][] af)
      throws MathException
      ***************
      *** 495,499 ****
      for(int l = 0; l < L; l++)
      {
      ! lo[l] = lo[N/2+l] + lo[l];
      }

      --- 510,514 ----
      for(int l = 0; l < L; l++)
      {
      ! lo[l] = lo[N/2 + l] + lo[l];
      }

      ***************
      *** 508,513 ****
      for(int h = 0; h < L; h++)
      {
      ! hi[h] = hi[N/2+h] + hi[h];
      }
      //hi = hi(1:N/2);
      double[] hiHalf = new double[N/2];
      --- 523,529 ----
      for(int h = 0; h < L; h++)
      {
      ! hi[h] = hi[N/2 + h] + hi[h];
      }
      +
      //hi = hi(1:N/2);
      double[] hiHalf = new double[N/2];
      ***************
      *** 521,529 ****
      throws MathException
      {
      ! int N = 2*lo.length;
      ! //int L = sf.length;
      int L = sf[0].length;
      lo = upfirdn(lo, sf[0], 2, 1);
      hi = upfirdn(hi, sf[1], 2, 1);
      double[] y = add(lo, hi);
      //y(1:L-2) = y(1:L-2) + y(N+[1:L-2]);
      --- 537,547 ----
      throws MathException
      {
      ! int N = 2 * lo.length;
      int L = sf[0].length;
      +
      lo = upfirdn(lo, sf[0], 2, 1);
      hi = upfirdn(hi, sf[1], 2, 1);
      +
      + // Recombine the signal
      double[] y = add(lo, hi);
      //y(1:L-2) = y(1:L-2) + y(N+[1:L-2]);
      ***************
      *** 533,536 ****
      --- 551,557 ----
      }
      //y = y(1:N);
      + //XXX
      +
      + //y = cshift(y, 1-L/2);
      y = cshift(y, 1-L/2);
      return y;
      ***************
      *** 615,620 ****
      for(int k = 0; k < J; k++)
      {
      ! x = afb(x, af)[0];
      ! w[k] = afb(x, af)[1];
      }

      --- 636,642 ----
      for(int k = 0; k < J; k++)
      {
      ! double[][] a = afb(x, af);
      ! x = a[0];
      ! w[k] = a[1];
      }





      ------------------------------

      Message: 3
      Date: Mon, 04 Jun 2012 02:25:07 +0000
      From: "Serguei A. Mokhov" <mokhov@...>
      Subject: [marf-cvs] marf/src/marf/junit/math - New directory
      To: marf-cvs@...
      Message-ID:
      <mailman.9818.1339960351.23886.marf-cvs@...>

      Update of /cvsroot/marf/marf/src/marf/junit/math
      In directory vz-cvs-4.sog:/tmp/cvs-serv8067/math

      Log Message:
      Directory /cvsroot/marf/marf/src/marf/junit/math added to the repository





      ------------------------------

      Message: 4
      Date: Mon, 04 Jun 2012 02:26:23 +0000
      From: "Serguei A. Mokhov" <mokhov@...>
      Subject: [marf-cvs] marf/src/marf/junit/math Algorithms.java,NONE,1.1
      To: marf-cvs@...
      Message-ID:
      <mailman.9819.1339960351.23886.marf-cvs@...>

      Update of /cvsroot/marf/marf/src/marf/junit/math
      In directory vz-cvs-4.sog:/tmp/cvs-serv8101/marf/junit/math

      Added Files:
      Algorithms.java
      Log Message:
      Fix a couple more small bugs and add JUnit test stubs and implement some
      to help to hunt those bugs down.


      --- NEW FILE: Algorithms.java ---
      package marf.junit.math;

      import static org.junit.Assert.fail;
      import marf.math.MathException;
      import marf.util.Arrays;

      import org.junit.After;
      import org.junit.Assert;
      import org.junit.Before;
      import org.junit.Test;


      /**
      * @author Serguei Mokhov
      * @since June 3, 2012
      */
      public class Algorithms
      {
      public static final double[] sdInitialSampleSignal =
      {
      1.1, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0,
      9.0, 10.0, -30.0, 31.0, -32.0, 33.0, -34.0,
      35.0, -36.0, 37.0, -38.0, 39.0, -40.0, 20.0,
      21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0,
      28.0, 29.0, 50.0, 51.0
      };

      /**
      * By 4 (-4).
      */
      public static final double[] sdLeftShiftedSampleSignal =
      {
      6.0, 7.0, 8.0,
      9.0, 10.0, -30.0, 31.0, -32.0, 33.0, -34.0,
      35.0, -36.0, 37.0, -38.0, 39.0, -40.0, 20.0,
      21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0,
      28.0, 29.0, 50.0, 51.0,

      1.1, 3.0, 4.0, 5.0,
      };

      /**
      * By 4.
      */
      public static final double[] sdRightShiftedSampleSignal =
      {
      28.0, 29.0, 50.0, 51.0,

      1.1, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0,
      9.0, 10.0, -30.0, 31.0, -32.0, 33.0, -34.0,
      35.0, -36.0, 37.0, -38.0, 39.0, -40.0, 20.0,
      21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0
      };

      /**
      * @throws java.lang.Exception
      */
      @Before
      public void setUp()
      throws Exception
      {
      }

      /**
      * @throws java.lang.Exception
      */
      @After
      public void tearDown()
      throws Exception
      {
      }

      /*
      * ---------------------------------------
      * Tests of the Algorithms.Wavelet methods
      * ---------------------------------------
      */

      /**
      * Test method for {@link marf.math.Algorithms.Wavelet#applyWaveletTransform(double[], double[], double[], double[], int)}.
      */
      @Test
      public void testApplyWaveletTransform()
      {
      fail("Not yet implemented");
      }

      /**
      * Test method for {@link marf.math.Algorithms.Wavelet#afb(double[], double[][])}.
      */
      @Test
      public void testAfb()
      throws Exception
      {
      ///*
      double[][] adLoHi = marf.math.Algorithms.Wavelet.afb
      (
      sdInitialSampleSignal,
      marf.math.Algorithms.Wavelet.af
      );

      double[][] adExpectedLoHi =
      {
      {
      3.4930, 7.4764, 9.0925, 15.5549, -8.1148, 1.8815, -0.2133,
      0.0000, 0.0000, -7.4246, 21.4488, 31.3034, 34.5584, 37.3868,
      40.2153, 70.799
      },
      {
      -9.4651, 0.0795, 0.4603, -2.9054, 26.9964, 46.3169, 47.4660,
      50.2944, 52.1798, 58.6756, 3.3588, 0.0000, 0.0000, 0.0000,
      3.5254, -5.3829
      }
      };

      /*
      -0.000000000000042 3.615083418816253 -13.700637494221198
      75.177956421733683 72.630676633836202 10.516787380577780
      8.041913646424739 -4.792572378170383 0.202082258745699
      -0.000000000000021
      */

      System.err.println("afb(0): " + Arrays.arrayToCSV(adLoHi[0]));
      System.err.println("expt.0: " + Arrays.arrayToCSV(adExpectedLoHi[0]));
      System.err.println("afb(1): " + Arrays.arrayToCSV(adLoHi[1]));
      System.err.println("expt.1: " + Arrays.arrayToCSV(adExpectedLoHi[1]));

      Assert.assertTrue(Arrays.equals(adLoHi[0], adExpectedLoHi[0]));
      Assert.assertTrue(Arrays.equals(adLoHi[1], adExpectedLoHi[1]));
      //*/
      }

      /**
      * Test method for {@link marf.math.Algorithms.Wavelet#sfb(double[], double[], double[][])}.
      */
      @Test
      public void testSfb()
      throws Exception
      {
      fail("Not yet implemented");
      }

      /**
      * Test method for {@link marf.math.Algorithms.Wavelet#farras()}.
      */
      @Test
      public void testFarras()
      {
      fail("Not yet implemented");
      }

      /**
      * Test method for {@link marf.math.Algorithms.Wavelet#add(double[], double[])}.
      */
      @Test
      public void testAdd()
      {
      fail("Not yet implemented");
      }

      /**
      * Test method for {@link marf.math.Algorithms.Wavelet#cshift(double[], int)}.
      */
      @Test
      public void testCshift()
      {
      double[] adShiftedSignal = marf.math.Algorithms.Wavelet.cshift(sdInitialSampleSignal, -4);

      //System.err.println(Arrays.arrayToCSV(sdInitialSampleSignal));
      //System.err.println(Arrays.arrayToCSV(sdLeftShiftedSampleSignal));
      //System.err.println(Arrays.arrayToCSV(adShiftedSignal));

      Assert.assertTrue(Arrays.equals(sdLeftShiftedSampleSignal, adShiftedSignal));
      Assert.assertEquals(Arrays.arrayToCSV(sdLeftShiftedSampleSignal), Arrays.arrayToCSV(adShiftedSignal));

      adShiftedSignal = marf.math.Algorithms.Wavelet.cshift(sdInitialSampleSignal, 4);
      //System.err.println(Arrays.arrayToCSV(sdRightShiftedSampleSignal));
      //System.err.println(Arrays.arrayToCSV(adShiftedSignal));
      Assert.assertTrue(Arrays.equals(sdRightShiftedSampleSignal, adShiftedSignal));

      adShiftedSignal = marf.math.Algorithms.Wavelet.cshift(sdInitialSampleSignal, -5);

      double[] adExpectedShiftedMinusFive =
      {
      7.0000, 8.0000, 9.0000, 10.0000, -30.0000, 31.0000, -32.0000,
      33.0000, -34.0000, 35.0000, -36.0000, 37.0000, -38.0000, 39.0000,
      -40.0000, 20.0000, 21.0000, 22.0000, 23.0000, 24.0000, 25.0000,
      26.0000, 27.0000, 28.0000, 29.0000, 50.0000, 51.0000, 1.1000,
      3.0000, 4.0000, 5.0000, 6.0000,
      };

      //System.err.println("cshift(-5): " + Arrays.arrayToCSV(adShiftedSignal));
      //System.err.println("expect(-5): " + Arrays.arrayToCSV(adExpectedShiftedMinusFive));
      Assert.assertTrue(Arrays.equals(adShiftedSignal, adExpectedShiftedMinusFive));
      }

      /**
      * Test method for {@link marf.math.Algorithms.Wavelet#soft(double[], int)}.
      */
      @Test
      public void testSoft()
      {
      fail("Not yet implemented");
      }

      /**
      * Test method for {@link marf.math.Algorithms.Wavelet#dwt(double[], int, double[][])}.
      */
      @Test
      public void testDwt()
      {
      fail("Not yet implemented");
      }

      /**
      * Test method for {@link marf.math.Algorithms.Wavelet#idwt(double[][], int, double[][])}.
      */
      @Test
      public void testIdwt()
      {
      fail("Not yet implemented");
      }

      /**
      * Test method for {@link marf.math.Algorithms.Wavelet#upfirdn(int, int, double[], double[])}.
      * @throws Exception
      */
      @Test
      public void testUpfirdnIntIntDoubleArrayDoubleArray()
      throws Exception
      {
      /*
      double[] adExpectedLo =
      {
      0, -0.0972, 0.6771, 4.8800, 7.6670, 10.5168, 8.0419,
      -4.7926, 0.2021, -0.0000, -0.0000, 1.8562, -7.1889, 35.1490,
      32.4818, 35.9726, 37.0333, 60.1433, 37.9635, -3.6209, 0.5726
      };
      */

      double[] adExpectedLo =
      {
      0.000000000000000, -0.09722718241315201, 0.6770796402890802,
      4.879998758002832, 7.66702935074179200, 10.5167873805777780,
      8.041913646424740, -4.792572378170382, 0.2020822587456994,
      -0.000000000000021, -0.000000000000021, 1.8561553006147014,
      -7.188858567255139, 35.148978831865421, 32.481823641547201,
      35.972631503293222, 37.033291675072974, 60.143279611178173,
      37.963508309738422, -3.620889150013660, 0.572566399779540
      };

      double[] adLo = marf.math.Algorithms.Wavelet.upfirdn
      (
      sdInitialSampleSignal,
      marf.math.Algorithms.Wavelet.af[0],
      1,
      2
      );

      //System.err.println("upfirdn(): " + Arrays.arrayToCSV(adLo));
      //System.err.println("expected : " + Arrays.arrayToCSV(adExpectedLo));

      double PRECISION_THRESHOLD = 0.0000000001;

      //System.err.println("adLo.length: " + adLo.length + ", adExpectedLo.length: " + adExpectedLo.length);
      Assert.assertEquals(adLo.length, adExpectedLo.length);

      for(int i = 0; i < adLo.length; i++)
      {
      Assert.assertTrue(Math.abs(adLo[i] - adExpectedLo[i]) < PRECISION_THRESHOLD);
      }
      }

      /**
      * Test method for {@link marf.math.Algorithms.Wavelet#upfirdn(double[], double[], int, int)}.
      * @throws Exception
      */
      @Test
      public void testUpfirdnDoubleArrayDoubleArrayIntInt()
      throws Exception
      {
      testUpfirdnIntIntDoubleArrayDoubleArray();
      }

      }

      // EOF




      ------------------------------

      Message: 5
      Date: Mon, 04 Jun 2012 02:26:23 +0000
      From: "Serguei A. Mokhov" <mokhov@...>
      Subject: [marf-cvs] marf/src/marf/Preprocessing/WaveletFilters
      WaveletFilter.java, 1.6, 1.7
      To: marf-cvs@...
      Message-ID:
      <mailman.9820.1339960351.23886.marf-cvs@...>

      Update of /cvsroot/marf/marf/src/marf/Preprocessing/WaveletFilters
      In directory vz-cvs-4.sog:/tmp/cvs-serv8101/marf/Preprocessing/WaveletFilters

      Modified Files:
      WaveletFilter.java
      Log Message:
      Fix a couple more small bugs and add JUnit test stubs and implement some
      to help to hunt those bugs down.


      Index: WaveletFilter.java
      ===================================================================
      RCS file: /cvsroot/marf/marf/src/marf/Preprocessing/WaveletFilters/WaveletFilter.java,v
      retrieving revision 1.6
      retrieving revision 1.7
      diff -C2 -d -r1.6 -r1.7
      *** WaveletFilter.java 3 Jun 2012 03:32:12 -0000 1.6
      --- WaveletFilter.java 4 Jun 2012 02:26:21 -0000 1.7
      ***************
      *** 79,99 ****
      }

      -
      // http://eeweb.poly.edu/iselesni/WaveletSoftware/allcode/denS2D.m
      // http://eeweb.poly.edu/iselesni/WaveletSoftware/denoise.html
      ! int J = 4;
      int T = 35;

      double[][] adDWTCoeffs = Algorithms.Wavelet.dwt(padSample, J, Algorithms.Wavelet.af);

      ! // loop thru scales:
      ! for(int j = 1; j <= J; j++)
      {
      ! // loop thru subbands
      ! //for(int s = 1; s <= 3; s++)
      ! {
      ! //w{j}{s} = soft(w{j}{s}, T);
      ! adDWTCoeffs[j] = Algorithms.Wavelet.soft(adDWTCoeffs[j], T);
      ! }
      }

      --- 79,94 ----
      }

      // http://eeweb.poly.edu/iselesni/WaveletSoftware/allcode/denS2D.m
      // http://eeweb.poly.edu/iselesni/WaveletSoftware/denoise.html
      ! //int J = 4;
      ! int J = 3;
      int T = 35;

      double[][] adDWTCoeffs = Algorithms.Wavelet.dwt(padSample, J, Algorithms.Wavelet.af);

      ! // Loop through scales and apply soft thresholding
      ! for(int j = 0; j < J; j++)
      {
      ! adDWTCoeffs[j] = Algorithms.Wavelet.soft(adDWTCoeffs[j], T);
      }

      ***************
      *** 101,107 ****
      // -- end

      !
      ! System.err.println("adFiltered" + adFiltered + ",padFiltered="+padFiltered);
      ! System.err.println("adFiltered.l" + adFiltered.length + ",padFiltered.l="+padFiltered.length);

      //Arrays.copy(padFiltered, 0, adFiltered);
      --- 96,101 ----
      // -- end

      ! System.err.println("adFiltered=" + adFiltered + ",padFiltered="+padFiltered);
      ! System.err.println("adFiltered.l=" + adFiltered.length + ",padFiltered.l="+padFiltered.length);

      //Arrays.copy(padFiltered, 0, adFiltered);




      ------------------------------

      Message: 6
      Date: Mon, 04 Jun 2012 02:26:23 +0000
      From: "Serguei A. Mokhov" <mokhov@...>
      Subject: [marf-cvs] marf/src/marf/math Algorithms.java,1.16,1.17
      To: marf-cvs@...
      Message-ID:
      <mailman.9821.1339960351.23886.marf-cvs@...>

      Update of /cvsroot/marf/marf/src/marf/math
      In directory vz-cvs-4.sog:/tmp/cvs-serv8101/marf/math

      Modified Files:
      Algorithms.java
      Log Message:
      Fix a couple more small bugs and add JUnit test stubs and implement some
      to help to hunt those bugs down.


      Index: Algorithms.java
      ===================================================================
      RCS file: /cvsroot/marf/marf/src/marf/math/Algorithms.java,v
      retrieving revision 1.16
      retrieving revision 1.17
      diff -C2 -d -r1.16 -r1.17
      *** Algorithms.java 3 Jun 2012 03:32:13 -0000 1.16
      --- Algorithms.java 4 Jun 2012 02:26:21 -0000 1.17
      ***************
      *** 596,600 ****
      }

      ! // http://eeweb.poly.edu/iselesni/WaveletSoftware/allcode/cshift.m
      public static final double[] cshift(double[] x, int m)
      {
      --- 596,606 ----
      }

      ! /**
      ! * Shifts x by m.
      ! * @param x
      ! * @param m > 0 shifts to the right; < 0 shifts to the left
      ! * @return
      ! * http://eeweb.poly.edu/iselesni/WaveletSoftware/allcode/cshift.m
      ! */
      public static final double[] cshift(double[] x, int m)
      {
      ***************
      *** 602,609 ****
      double[] y = new double[N];

      ! for(int n = 0; n < N-1; n++)
      {
      int i = (n - m) % N;
      ! y[i] = x[n];
      }

      --- 608,627 ----
      double[] y = new double[N];

      ! //System.err.println("cshift: N="+N);
      ! //System.err.println("cshift: m="+m);
      !
      ! for(int n = 0; n < N; n++)
      {
      + // Compute mod() and take care of the negative
      int i = (n - m) % N;
      ! //System.err.println("cshift: i(1)="+i);
      ! if(i < 0)
      ! {
      ! i += N;
      ! }
      ! //System.err.println("cshift: i(2)="+i);
      ! //System.err.println("cshift: n( )="+n);
      !
      ! y[n] = x[i];
      }

      ***************
      *** 612,618 ****

      // http://eeweb.poly.edu/iselesni/WaveletSoftware/allcode/soft.m
      public static final double[] soft(double[] x, int T)
      {
      - //function y = soft(x,T)
      double[] y = new double[x.length];

      --- 630,636 ----

      // http://eeweb.poly.edu/iselesni/WaveletSoftware/allcode/soft.m
      + // function y = soft(x,T)
      public static final double[] soft(double[] x, int T)
      {
      double[] y = new double[x.length];

      ***************
      *** 621,626 ****
      for(int i = 0; i < y.length; i++)
      {
      ! y[i] = Math.max(Math.abs(x[i]), T);
      ! y[i] = y[i] / (y[i] + T) * x[i];
      }

      --- 639,647 ----
      for(int i = 0; i < y.length; i++)
      {
      ! // Filter out coefficients below the threshold
      ! y[i] = Math.max(Math.abs(x[i]) - T, 0);
      !
      ! // Restore the values and signs especially
      ! y[i] = (y[i] / (y[i] + T)) * x[i];
      }

      ***************
      *** 763,768 ****
      System.err.println("statePtr="+statePtr+",h="+h+",_state.l="+_state.length+",in.l="+in.length);
      // XXX: Kludge and hack
      ! if(h >= in.length) break;
      ! acc += _state[statePtr++] * in[h++];
      }

      --- 784,797 ----
      System.err.println("statePtr="+statePtr+",h="+h+",_state.l="+_state.length+",in.l="+in.length);
      // XXX: Kludge and hack
      ! /*
      ! if(h >= in.length)
      ! {
      ! System.err.println("XXX: Kludge and hack activated.");
      ! break;
      ! }
      ! */
      !
      ! //acc += _state[statePtr++] * in[h++];
      ! acc += _state[statePtr++] * _transposedCoefs[h++];
      }

      ***************
      *** 774,779 ****
      //acc += *xPtr++ * *h++;
      // XXX: Kludge and hack
      ! if(h >= in.length||xPtr>= in.length) break;
      ! acc += in[xPtr++] * in[h++];
      }

      --- 803,809 ----
      //acc += *xPtr++ * *h++;
      // XXX: Kludge and hack
      ! //if(h >= in.length||xPtr>= in.length) break;
      ! //acc += in[xPtr++] * in[h++];
      ! acc += in[xPtr++] * _transposedCoefs[h++];
      }

      ***************
      *** 863,867 ****
      double[] inputPadded = new double[input.length + padding];

      ! for(int i = 0; i < input.length + padding; i++)
      {
      if(i < input.length)
      --- 893,898 ----
      double[] inputPadded = new double[input.length + padding];

      ! //for(int i = 0; i < input.length + padding; i++)
      ! for(int i = 0; i < inputPadded.length; i++)
      {
      if(i < input.length)
      ***************
      *** 876,880 ****

      // calc size of output
      ! int resultsCount = theResampler.neededOutCount(input.length + padding);

      // results.resize(resultsCount);
      --- 907,912 ----

      // calc size of output
      ! //int resultsCount = theResampler.neededOutCount(input.length + padding);
      ! int resultsCount = theResampler.neededOutCount(inputPadded.length);

      // results.resize(resultsCount);
      ***************
      *** 890,893 ****
      --- 922,930 ----
      );

      + if(numSamplesComputed != resultsCount)
      + {
      + System.err.println("upfirdn: numSamplesComputed != resultsCount: " + numSamplesComputed + " != " + resultsCount);
      + }
      +
      //delete[] inputPadded;
      inputPadded = null;




      ------------------------------

      Message: 7
      Date: Fri, 08 Jun 2012 20:55:30 +0000
      From: "Serguei A. Mokhov" <mokhov@...>
      Subject: [marf-cvs] marf .classpath,1.6,1.7
      To: marf-cvs@...
      Message-ID:
      <mailman.9822.1339960351.23886.marf-cvs@...>

      Update of /cvsroot/marf/marf
      In directory vz-cvs-4.sog:/tmp/cvs-serv11962/marf

      Modified Files:
      .classpath
      Log Message:
      Commit more debug/testing reporting, etc.


      Index: .classpath
      ===================================================================
      RCS file: /cvsroot/marf/marf/.classpath,v
      retrieving revision 1.6
      retrieving revision 1.7
      diff -C2 -d -r1.6 -r1.7
      *** .classpath 2 Jan 2006 21:27:08 -0000 1.6
      --- .classpath 8 Jun 2012 20:55:27 -0000 1.7
      ***************
      *** 3,7 ****
      <classpathentry excluding="*CVS*" kind="src" path="src"/>
      <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
      ! <classpathentry sourcepath="ECLIPSE_HOME/plugins/org.eclipse.jdt.source_3.1.1/src/org.junit_3.8.1/junitsrc.zip" kind="var" path="JUNIT_HOME/junit.jar"/>
      <classpathentry kind="output" path="bin"/>
      </classpath>
      --- 3,7 ----
      <classpathentry excluding="*CVS*" kind="src" path="src"/>
      <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
      ! <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
      <classpathentry kind="output" path="bin"/>
      </classpath>




      ------------------------------

      Message: 8
      Date: Fri, 08 Jun 2012 20:55:30 +0000
      From: "Serguei A. Mokhov" <mokhov@...>
      Subject: [marf-cvs] marf/src/marf/math Algorithms.java,1.17,1.18
      To: marf-cvs@...
      Message-ID:
      <mailman.9823.1339960351.23886.marf-cvs@...>

      Update of /cvsroot/marf/marf/src/marf/math
      In directory vz-cvs-4.sog:/tmp/cvs-serv11962/marf/src/marf/math

      Modified Files:
      Algorithms.java
      Log Message:
      Commit more debug/testing reporting, etc.


      Index: Algorithms.java
      ===================================================================
      RCS file: /cvsroot/marf/marf/src/marf/math/Algorithms.java,v
      retrieving revision 1.17
      retrieving revision 1.18
      diff -C2 -d -r1.17 -r1.18
      *** Algorithms.java 4 Jun 2012 02:26:21 -0000 1.17
      --- Algorithms.java 8 Jun 2012 20:55:28 -0000 1.18
      ***************
      *** 507,510 ****
      --- 507,511 ----
      // lowpass filter
      double[] lo = upfirdn(x, af[0], 1, 2);
      + //System.err.println("lo[.0.] " + lo.length + ": " + Arrays.arrayToCSV(lo));
      // lo(1:L) = lo(N/2+[1:L]) + lo(1:L);
      for(int l = 0; l < L; l++)
      ***************
      *** 512,515 ****
      --- 513,518 ----
      lo[l] = lo[N/2 + l] + lo[l];
      }
      +
      + //System.err.println("lo[.1.] " + lo.length + ": " + Arrays.arrayToCSV(lo));

      //lo = lo(1:N/2);
      ***************
      *** 517,520 ****
      --- 520,524 ----
      Arrays.copy(loHalf, lo, N/2);

      + //System.err.println("lo[.2.] " + loHalf.length + ": " + Arrays.arrayToCSV(loHalf));

      // highpass filter




      ------------------------------

      Message: 9
      Date: Fri, 08 Jun 2012 20:55:30 +0000
      From: "Serguei A. Mokhov" <mokhov@...>
      Subject: [marf-cvs] marf/src/marf/junit/math Algorithms.java,1.1,1.2
      To: marf-cvs@...
      Message-ID:
      <mailman.9824.1339960351.23886.marf-cvs@...>

      Update of /cvsroot/marf/marf/src/marf/junit/math
      In directory vz-cvs-4.sog:/tmp/cvs-serv11962/marf/src/marf/junit/math

      Modified Files:
      Algorithms.java
      Log Message:
      Commit more debug/testing reporting, etc.


      Index: Algorithms.java
      ===================================================================
      RCS file: /cvsroot/marf/marf/src/marf/junit/math/Algorithms.java,v
      retrieving revision 1.1
      retrieving revision 1.2
      diff -C2 -d -r1.1 -r1.2
      *** Algorithms.java 4 Jun 2012 02:26:21 -0000 1.1
      --- Algorithms.java 8 Jun 2012 20:55:28 -0000 1.2
      ***************
      *** 103,124 ****
      {
      {
      ! 3.4930, 7.4764, 9.0925, 15.5549, -8.1148, 1.8815, -0.2133,
      ! 0.0000, 0.0000, -7.4246, 21.4488, 31.3034, 34.5584, 37.3868,
      ! 40.2153, 70.799
      },
      {
      ! -9.4651, 0.0795, 0.4603, -2.9054, 26.9964, 46.3169, 47.4660,
      ! 50.2944, 52.1798, 58.6756, 3.3588, 0.0000, 0.0000, 0.0000,
      ! 3.5254, -5.3829
      }
      };

      - /*
      - -0.000000000000042 3.615083418816253 -13.700637494221198
      - 75.177956421733683 72.630676633836202 10.516787380577780
      - 8.041913646424739 -4.792572378170383 0.202082258745699
      - -0.000000000000021
      - */
      -
      System.err.println("afb(0): " + Arrays.arrayToCSV(adLoHi[0]));
      System.err.println("expt.0: " + Arrays.arrayToCSV(adExpectedLoHi[0]));
      --- 103,123 ----
      {
      {
      ! 3.493035107734180, 7.476375421596027, 9.092469705267412,
      ! 15.554923196531979, -8.114797233204499, 1.881460864063819,
      ! -0.213309050898237, 0.000000000000019, 0.000000000000019,
      ! -7.424621202458860, 21.448784946375856, 31.303372714377456,
      ! 34.558417940920137, 37.386845065666293, 40.215272190412463,
      ! 70.799349363635130
      },
      {
      ! -9.465126754962579, 0.079549512883508, 0.460298478254160,
      ! -2.905407555818540, 26.996404377910419, 46.316920157290419,
      ! 47.465968676718497, 50.294395801464660, 52.179772385397456,
      ! 58.675602942762893, 3.358757210636180, 0.000000000000019,
      ! 0.000000000000019, 0.000000000000019, 3.525429792995532,
      ! -5.382850371782672
      }
      };

      System.err.println("afb(0): " + Arrays.arrayToCSV(adLoHi[0]));
      System.err.println("expt.0: " + Arrays.arrayToCSV(adExpectedLoHi[0]));




      ------------------------------

      Message: 10
      Date: Sun, 17 Jun 2012 19:12:31 +0000
      From: "Serguei A. Mokhov" <mokhov@...>
      Subject: [marf-cvs] marf/src/marf/Classification
      ClassificationFactory.java, 1.5, 1.6
      To: marf-cvs@...
      Message-ID:
      <mailman.9825.1339960351.23886.marf-cvs@...>

      Update of /cvsroot/marf/marf/src/marf/Classification
      In directory vz-cvs-4.sog:/tmp/cvs-serv20358/marf/src/marf/Classification

      Modified Files:
      ClassificationFactory.java
      Log Message:
      Parametrize Class code. Add getClassificationClassByID() to be able
      to get a Class from the numerical classifier ID.


      Index: ClassificationFactory.java
      ===================================================================
      RCS file: /cvsroot/marf/marf/src/marf/Classification/ClassificationFactory.java,v
      retrieving revision 1.5
      retrieving revision 1.6
      diff -C2 -d -r1.5 -r1.6
      *** ClassificationFactory.java 31 Dec 2007 00:17:04 -0000 1.5
      --- ClassificationFactory.java 17 Jun 2012 19:12:29 -0000 1.6
      ***************
      *** 18,27 ****

      /**
      ! * <p>Provides a factory to instantiate requested classification module(s).</p>
      ! *
      ! * $Id$
      *
      * @author Serguei Mokhov
      ! * @version $Revision$
      * @since 0.3.0.5
      */
      --- 18,25 ----

      /**
      ! * Provides a factory to instantiate requested classification module(s).
      *
      * @author Serguei Mokhov
      ! * @version $Id$
      * @since 0.3.0.5
      */
      ***************
      *** 200,203 ****
      --- 198,263 ----

      /**
      + * Allows to query for Class objects of the classifiers based on ID
      + * for reflection and other purposes.
      + * @param piClassificationMethod numerical classifier ID
      + * @return the Class object corresponding to the numerical classifier
      + * @throws ClassificationException if the numerical ID not known
      + * @since 0.3.0.6; June 17, 2012
      + */
      + public static final Class<?> getClassificationClassByID(final int piClassificationMethod)
      + throws ClassificationException
      + {
      + switch(piClassificationMethod)
      + {
      + case MARF.NEURAL_NETWORK:
      + return NeuralNetwork.class;
      +
      + case MARF.STOCHASTIC:
      + return Stochastic.class;
      +
      + case MARF.MARKOV:
      + return Markov.class;
      +
      + case MARF.EUCLIDEAN_DISTANCE:
      + return EuclideanDistance.class;
      +
      + case MARF.CHEBYSHEV_DISTANCE:
      + return ChebyshevDistance.class;
      +
      + case MARF.MINKOWSKI_DISTANCE:
      + return MinkowskiDistance.class;
      +
      + case MARF.MAHALANOBIS_DISTANCE:
      + return MahalanobisDistance.class;
      +
      + case MARF.RANDOM_CLASSIFICATION:
      + return RandomClassification.class;
      +
      + case MARF.DIFF_DISTANCE:
      + return DiffDistance.class;
      +
      + case MARF.HAMMING_DISTANCE:
      + return HammingDistance.class;
      +
      + case MARF.COSINE_SIMILARITY_MEASURE:
      + return CosineSimilarityMeasure.class;
      +
      + case MARF.CLASSIFICATION_PLUGIN:
      + return MARF.getClassificationPluginClass();
      +
      + case MARF.ZIPFS_LAW:
      + return ZipfLaw.class;
      +
      + default:
      + {
      + throw new ClassificationException
      + (
      + "Unknown classification method: " + piClassificationMethod
      + );
      + }
      + }
      + }
      +
      + /**
      * Returns source code revision information.
      * @return revision string




      ------------------------------

      ------------------------------------------------------------------------------
      Live Security Virtual Conference
      Exclusive live event will cover all the ways today's security and
      threat landscape has changed and how IT managers can respond. Discussions
      will include endpoint security, mobile security and the latest in malware
      threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

      ------------------------------

      _______________________________________________
      marf-cvs mailing list
      marf-cvs@...
      https://lists.sourceforge.net/lists/listinfo/marf-cvs


      End of marf-cvs Digest, Vol 24, Issue 1
      ***************************************
    Your message has been successfully submitted and would be delivered to recipients shortly.