Esempio n. 1
0
  public void testVariantDate() {
    SYSTEMTIME lpSystemTime = new SYSTEMTIME();
    Kernel32.INSTANCE.GetLocalTime(lpSystemTime);

    DoubleByReference pvtime = new DoubleByReference();
    OleAuto.INSTANCE.SystemTimeToVariantTime(lpSystemTime, pvtime);

    VARIANT variantDate = new VARIANT(new DATE(pvtime.getValue()));
  }
  /*
   * Does the LMA fit according to whether the library is accessed via JNA or
   * JNI.
   */
  private int doLMAFit(
      double xInc,
      double y[],
      int fitStart,
      int fitEnd,
      double instr[],
      int n_instr,
      int noise,
      double sig[],
      double param[],
      int paramFree[],
      int nParam,
      double fitted[],
      double chiSquare[],
      double chiSquareTarget,
      double chiSquareDelta) {
    int returnValue = 0;

    if (s_libraryOnPath) {
      // JNA version

      DoubleByReference chiSquareRef = new DoubleByReference(chiSquare[0]);

      returnValue =
          s_library.LMA_fit(
              xInc,
              y,
              fitStart,
              fitEnd,
              instr,
              n_instr,
              noise,
              sig,
              param,
              paramFree,
              nParam,
              fitted,
              chiSquareRef,
              chiSquareTarget,
              chiSquareDelta);

      chiSquare[0] = chiSquareRef.getValue();
    } else {
      // JNI version

      returnValue =
          LMA_fit(
              xInc,
              y,
              fitStart,
              fitEnd,
              instr,
              n_instr,
              noise,
              sig,
              param,
              paramFree,
              nParam,
              fitted,
              chiSquare,
              chiSquareTarget,
              chiSquareDelta);
    }
    return returnValue;
  }
  /*
   * Does the RLD fit according to whether the library is accessed via JNA or
   * JNI.
   */
  private int doRLDFit(
      double xInc,
      double y[],
      int fitStart,
      int fitEnd,
      double instr[],
      int nInstr,
      int noise,
      double sig[],
      double z[],
      double a[],
      double tau[],
      double fitted[],
      double chiSquare[],
      double chiSquareTarget) {
    int returnValue = 0;
    if (s_libraryOnPath) {
      // JNA version

      DoubleByReference zRef = new DoubleByReference(z[0]);
      DoubleByReference aRef = new DoubleByReference(a[0]);
      DoubleByReference tauRef = new DoubleByReference(tau[0]);
      DoubleByReference chiSquareRef = new DoubleByReference(chiSquare[0]);

      returnValue =
          s_library.RLD_fit(
              xInc,
              y,
              fitStart,
              fitEnd,
              instr,
              nInstr,
              noise,
              sig,
              zRef,
              aRef,
              tauRef,
              fitted,
              chiSquareRef,
              chiSquareTarget);

      z[0] = zRef.getValue();
      a[0] = aRef.getValue();
      tau[0] = tauRef.getValue();
      chiSquare[0] = chiSquareRef.getValue();
    } else {
      // JNI version

      returnValue =
          RLD_fit(
              xInc,
              y,
              fitStart,
              fitEnd,
              instr,
              nInstr,
              noise,
              sig,
              z,
              a,
              tau,
              fitted,
              chiSquare,
              chiSquareTarget);
    }
    return returnValue;
  }