/**
  * Optimized method to append a OpenMapRealVector.
  *
  * @param v vector to append
  * @return The result of appending <code>v</code> to self
  */
 public OpenMapRealVector append(OpenMapRealVector v) {
   OpenMapRealVector res = new OpenMapRealVector(this, v.getDimension());
   Iterator iter = v.entries.iterator();
   while (iter.hasNext()) {
     iter.advance();
     res.setEntry(iter.key() + virtualSize, iter.value());
   }
   return res;
 }
 /**
  * Optimized method to compute the outer product.
  *
  * @param v The vector to comput the outer product on
  * @return The outer product of <code>this</code> and <code>v</code>
  * @throws IllegalArgumentException If the dimensions don't match
  */
 public OpenMapRealMatrix outerproduct(OpenMapRealVector v) throws IllegalArgumentException {
   checkVectorDimensions(v.getDimension());
   OpenMapRealMatrix res = new OpenMapRealMatrix(virtualSize, virtualSize);
   Iterator iter = entries.iterator();
   while (iter.hasNext()) {
     iter.advance();
     Iterator iter2 = v.getEntries().iterator();
     while (iter2.hasNext()) {
       iter2.advance();
       res.setEntry(iter.key(), iter2.key(), iter.value() * iter2.value());
     }
   }
   return res;
 }
 /**
  * Optimized method to add two OpenMapRealVectors.
  *
  * @param v Vector to add with
  * @return The sum of <code>this</code> with <code>v</code>
  * @throws IllegalArgumentException If the dimensions don't match
  */
 public OpenMapRealVector add(OpenMapRealVector v) throws IllegalArgumentException {
   checkVectorDimensions(v.getDimension());
   OpenMapRealVector res = (OpenMapRealVector) copy();
   Iterator iter = v.getEntries().iterator();
   while (iter.hasNext()) {
     iter.advance();
     int key = iter.key();
     if (entries.containsKey(key)) {
       res.setEntry(key, entries.get(key) + iter.value());
     } else {
       res.setEntry(key, iter.value());
     }
   }
   return res;
 }
  public void test4() throws Throwable {

    java.lang.Double var0 = new java.lang.Double((-1.0d));
    double[] var1 = new double[] {var0};
    org.apache.commons.math.linear.OpenMapRealVector var2 =
        new org.apache.commons.math.linear.OpenMapRealVector(var1);
    int var3 = var2.getDimension();
    java.lang.Double var4 = new java.lang.Double((-1.0d));
    java.lang.Double var5 = new java.lang.Double(0.0d);
    java.lang.Double var6 = new java.lang.Double((-1.0d));
    double[] var7 = new double[] {var4, var5, var6};
    org.apache.commons.math.linear.ArrayRealVector var8 =
        new org.apache.commons.math.linear.ArrayRealVector(var7);
    java.lang.Double var9 = new java.lang.Double((-1.0d));
    java.lang.Double var10 = new java.lang.Double(0.0d);
    java.lang.Double var11 = new java.lang.Double((-1.0d));
    double[] var12 = new double[] {var9, var10, var11};
    org.apache.commons.math.linear.ArrayRealVector var13 =
        new org.apache.commons.math.linear.ArrayRealVector(var12);
    org.apache.commons.math.linear.RealVector var14 =
        var8.ebeDivide((org.apache.commons.math.linear.RealVector) var13);
    java.lang.Double var15 = new java.lang.Double((-1.0d));
    java.lang.Double var16 = new java.lang.Double(10.0d);
    java.lang.Double var17 = new java.lang.Double(100.0d);
    int var18 =
        org.apache.commons.math.util.MathUtils.compareTo(
            (double) var15, (double) var16, (double) var17);
    org.apache.commons.math.linear.RealVector var19 = var13.mapPowToSelf((double) var17);
    org.apache.commons.math.linear.ArrayRealVector var20 =
        new org.apache.commons.math.linear.ArrayRealVector(var3, var17);
    java.lang.Double var21 = new java.lang.Double((-1.0d));
    double[] var22 = new double[] {var21};
    org.apache.commons.math.linear.OpenMapRealVector var23 =
        new org.apache.commons.math.linear.OpenMapRealVector(var22);
    java.lang.Double var24 = new java.lang.Double((-1.0d));
    double[] var25 = new double[] {var24};
    org.apache.commons.math.linear.OpenMapRealVector var26 =
        new org.apache.commons.math.linear.OpenMapRealVector(var25);
    org.apache.commons.math.linear.OpenMapRealVector var27 = var23.add(var26);
    org.apache.commons.math.linear.OpenMapRealVector var28 =
        new org.apache.commons.math.linear.OpenMapRealVector(var27);
    java.lang.Double var29 = new java.lang.Double((-1.0d));
    java.lang.Double var30 = new java.lang.Double(0.0d);
    java.lang.Double var31 = new java.lang.Double((-1.0d));
    double[] var32 = new double[] {var29, var30, var31};
    org.apache.commons.math.linear.ArrayRealVector var33 =
        new org.apache.commons.math.linear.ArrayRealVector(var32);
    java.lang.Double var34 = new java.lang.Double((-1.0d));
    java.lang.Double var35 = new java.lang.Double(0.0d);
    java.lang.Double var36 = new java.lang.Double((-1.0d));
    double[] var37 = new double[] {var34, var35, var36};
    org.apache.commons.math.linear.ArrayRealVector var38 =
        new org.apache.commons.math.linear.ArrayRealVector(var37);
    org.apache.commons.math.linear.RealVector var39 =
        var33.ebeDivide((org.apache.commons.math.linear.RealVector) var38);
    java.lang.Double var40 = new java.lang.Double(0.0d);
    java.lang.Double var41 = new java.lang.Double((-1.0d));
    java.lang.Double var42 = new java.lang.Double((-1.0d));
    int var43 =
        org.apache.commons.math.util.MathUtils.compareTo(
            (double) var40, (double) var41, (double) var42);
    org.apache.commons.math.linear.RealVector var44 = var33.mapDivide((double) var41);
    org.apache.commons.math.linear.RealVector var45 = var28.mapSubtractToSelf((double) var41);
    org.apache.commons.math.linear.RealVector var46 = var20.projection(var45);

    // Checks the contract:  equals-hashcode on var19 and var44
    assertTrue(
        "Contract failed: equals-hashcode on var19 and var44",
        var19.equals(var44) ? var19.hashCode() == var44.hashCode() : true);

    // Checks the contract:  equals-hashcode on var44 and var19
    assertTrue(
        "Contract failed: equals-hashcode on var44 and var19",
        var44.equals(var19) ? var44.hashCode() == var19.hashCode() : true);
  }
  public void test13() throws Throwable {

    java.lang.Double var0 = new java.lang.Double((-1.0d));
    double[] var1 = new double[] {var0};
    org.apache.commons.math.linear.OpenMapRealVector var2 =
        new org.apache.commons.math.linear.OpenMapRealVector(var1);
    java.lang.Double var3 = new java.lang.Double((-1.0d));
    double[] var4 = new double[] {var3};
    org.apache.commons.math.linear.OpenMapRealVector var5 =
        new org.apache.commons.math.linear.OpenMapRealVector(var4);
    org.apache.commons.math.linear.OpenMapRealVector var6 = var2.add(var5);
    org.apache.commons.math.linear.OpenMapRealVector var7 =
        new org.apache.commons.math.linear.OpenMapRealVector(var6);
    java.lang.Double var8 = new java.lang.Double((-1.0d));
    java.lang.Double var9 = new java.lang.Double(0.0d);
    java.lang.Double var10 = new java.lang.Double((-1.0d));
    double[] var11 = new double[] {var8, var9, var10};
    org.apache.commons.math.linear.ArrayRealVector var12 =
        new org.apache.commons.math.linear.ArrayRealVector(var11);
    java.lang.Double var13 = new java.lang.Double((-1.0d));
    java.lang.Double var14 = new java.lang.Double(0.0d);
    java.lang.Double var15 = new java.lang.Double((-1.0d));
    double[] var16 = new double[] {var13, var14, var15};
    org.apache.commons.math.linear.ArrayRealVector var17 =
        new org.apache.commons.math.linear.ArrayRealVector(var16);
    org.apache.commons.math.linear.RealVector var18 =
        var12.ebeDivide((org.apache.commons.math.linear.RealVector) var17);
    java.lang.Double var19 = new java.lang.Double(0.0d);
    java.lang.Double var20 = new java.lang.Double((-1.0d));
    java.lang.Double var21 = new java.lang.Double((-1.0d));
    int var22 =
        org.apache.commons.math.util.MathUtils.compareTo(
            (double) var19, (double) var20, (double) var21);
    org.apache.commons.math.linear.RealVector var23 = var12.mapDivide((double) var20);
    org.apache.commons.math.linear.RealVector var24 = var7.mapSubtractToSelf((double) var20);
    double var25 = var7.getSparcity();
    java.lang.Double var26 = new java.lang.Double((-1.0d));
    double[] var27 = new double[] {var26};
    org.apache.commons.math.linear.OpenMapRealVector var28 =
        new org.apache.commons.math.linear.OpenMapRealVector(var27);
    int var29 = var28.getDimension();
    java.lang.Double var30 = new java.lang.Double((-1.0d));
    java.lang.Double var31 = new java.lang.Double(0.0d);
    java.lang.Double var32 = new java.lang.Double((-1.0d));
    double[] var33 = new double[] {var30, var31, var32};
    org.apache.commons.math.linear.ArrayRealVector var34 =
        new org.apache.commons.math.linear.ArrayRealVector(var33);
    java.lang.Double var35 = new java.lang.Double((-1.0d));
    java.lang.Double var36 = new java.lang.Double(0.0d);
    java.lang.Double var37 = new java.lang.Double((-1.0d));
    double[] var38 = new double[] {var35, var36, var37};
    org.apache.commons.math.linear.ArrayRealVector var39 =
        new org.apache.commons.math.linear.ArrayRealVector(var38);
    org.apache.commons.math.linear.RealVector var40 =
        var34.ebeDivide((org.apache.commons.math.linear.RealVector) var39);
    java.lang.Double var41 = new java.lang.Double((-1.0d));
    java.lang.Double var42 = new java.lang.Double(10.0d);
    java.lang.Double var43 = new java.lang.Double(100.0d);
    int var44 =
        org.apache.commons.math.util.MathUtils.compareTo(
            (double) var41, (double) var42, (double) var43);
    org.apache.commons.math.linear.RealVector var45 = var39.mapPowToSelf((double) var43);
    org.apache.commons.math.linear.ArrayRealVector var46 =
        new org.apache.commons.math.linear.ArrayRealVector(var29, var43);
    java.lang.Double var47 = new java.lang.Double((-1.0d));
    java.lang.Double var48 = new java.lang.Double(10.0d);
    java.lang.Double var49 = new java.lang.Double(1.0d);
    java.lang.Double var50 = new java.lang.Double(1.0d);
    boolean var51 = org.apache.commons.math.util.MathUtils.equals((double) var49, (double) var50);
    int var52 =
        org.apache.commons.math.util.MathUtils.compareTo(
            (double) var47, (double) var48, (double) var49);
    java.lang.Double var53 = new java.lang.Double((-1.0d));
    java.lang.Double var54 = new java.lang.Double(0.0d);
    java.lang.Double var55 = new java.lang.Double((-1.0d));
    double[] var56 = new double[] {var53, var54, var55};
    org.apache.commons.math.linear.ArrayRealVector var57 =
        new org.apache.commons.math.linear.ArrayRealVector(var56);
    java.lang.Double var58 = new java.lang.Double((-1.0d));
    java.lang.Double var59 = new java.lang.Double(0.0d);
    java.lang.Double var60 = new java.lang.Double((-1.0d));
    double[] var61 = new double[] {var58, var59, var60};
    org.apache.commons.math.linear.ArrayRealVector var62 =
        new org.apache.commons.math.linear.ArrayRealVector(var61);
    org.apache.commons.math.linear.RealVector var63 =
        var57.ebeDivide((org.apache.commons.math.linear.RealVector) var62);
    org.apache.commons.math.linear.RealVector var64 = var57.mapLog10ToSelf();
    java.lang.Double var65 = new java.lang.Double(1.0d);
    org.apache.commons.math.linear.RealVector var66 = var57.mapMultiplyToSelf((double) var65);
    double var67 = org.apache.commons.math.util.MathUtils.indicator((double) var65);
    java.lang.Double var68 = new java.lang.Double((-1.0d));
    java.lang.Double var69 = new java.lang.Double(10.0d);
    java.lang.Double var70 = new java.lang.Double(100.0d);
    int var71 =
        org.apache.commons.math.util.MathUtils.compareTo(
            (double) var68, (double) var69, (double) var70);
    double var72 =
        org.apache.commons.math.util.MathUtils.normalizeAngle((double) var65, (double) var69);
    java.lang.Integer var73 = new java.lang.Integer(10);
    java.lang.Integer var74 = new java.lang.Integer(10);
    double var75 =
        org.apache.commons.math.util.MathUtils.binomialCoefficientLog((int) var73, (int) var74);
    java.lang.Integer var76 = new java.lang.Integer(0);
    java.lang.Long var77 = new java.lang.Long(100L);
    int var78 = org.apache.commons.math.util.MathUtils.pow((int) var76, (long) var77);
    double var79 =
        org.apache.commons.math.util.MathUtils.binomialCoefficientLog((int) var74, (int) var76);
    boolean var80 =
        org.apache.commons.math.util.MathUtils.equalsIncludingNaN(
            (double) var49, (double) var69, (int) var76);
    org.apache.commons.math.linear.RealVector var81 = var46.mapMultiplyToSelf((double) var49);
    org.apache.commons.math.linear.RealVector var82 = var7.mapPow((double) var49);

    // Checks the contract:  equals-hashcode on var23 and var45
    assertTrue(
        "Contract failed: equals-hashcode on var23 and var45",
        var23.equals(var45) ? var23.hashCode() == var45.hashCode() : true);

    // Checks the contract:  equals-hashcode on var45 and var23
    assertTrue(
        "Contract failed: equals-hashcode on var45 and var23",
        var45.equals(var23) ? var45.hashCode() == var23.hashCode() : true);
  }
 /**
  * Build a resized vector, for use with append.
  *
  * @param v The original vector
  * @param resize The amount to resize it
  */
 protected OpenMapRealVector(OpenMapRealVector v, int resize) {
   virtualSize = v.getDimension() + resize;
   entries = new OpenIntToDoubleHashMap(v.entries);
   epsilon = v.getEpsilon();
 }
 /**
  * Copy constructor.
  *
  * @param v The instance to copy from
  */
 public OpenMapRealVector(OpenMapRealVector v) {
   virtualSize = v.getDimension();
   entries = new OpenIntToDoubleHashMap(v.getEntries());
   epsilon = v.getEpsilon();
 }