Examples of RationalNumber


Examples of de.lmu.ifi.dbs.elki.data.RationalNumber

          firstCol = col;
        }
      }
      if(firstCol > -1) {
        for(int currentRow = row - 1; currentRow >= 0; currentRow--) {
          RationalNumber multiplier = gauss[currentRow][firstCol].copy();
          for(int col = firstCol; col < gauss[currentRow].length; col++) {
            RationalNumber subtrahent = gauss[row][col].times(multiplier);
            gauss[currentRow][col] = gauss[currentRow][col].minus(subtrahent);
          }
        }
      }
    }
View Full Code Here

Examples of de.lmu.ifi.dbs.elki.data.RationalNumber

   */
  private final RationalNumber[][] exactGaussElimination() {
    final RationalNumber[][] gauss = new RationalNumber[elements.length][this.columndimension];
    for(int row = 0; row < elements.length; row++) {
      for(int col = 0; col < this.columndimension; col++) {
        gauss[row][col] = new RationalNumber(elements[row][col]);
      }
    }
    return exactGaussElimination(gauss);
  }
View Full Code Here

Examples of de.lmu.ifi.dbs.elki.data.RationalNumber

        System.arraycopy(row, 0, gauss[0], 0, row.length);
      }

      // 3. create leading 1
      if(!gauss[0][firstCol].equals(RationalNumber.ONE)) {
        final RationalNumber inverse = gauss[0][firstCol].multiplicativeInverse();
        for(int col = 0; col < gauss[0].length; col++) {
          gauss[0][col] = gauss[0][col].times(inverse);
        }
      }

      // 4. eliminate values unequal to zero below leading 1
      for(int row = 1; row < gauss.length; row++) {
        final RationalNumber multiplier = gauss[row][firstCol].copy();
        // if(multiplier != 0.0)
        if(!multiplier.equals(RationalNumber.ZERO)) {
          for(int col = firstCol; col < gauss[row].length; col++) {
            final RationalNumber subtrahent = gauss[0][col].times(multiplier);
            gauss[row][col] = gauss[row][col].minus(subtrahent);
          }
        }
      }
View Full Code Here

Examples of de.lmu.ifi.dbs.elki.data.RationalNumber

          firstCol = col;
        }
      }
      if(firstCol > -1) {
        for(int currentRow = row - 1; currentRow >= 0; currentRow--) {
          RationalNumber multiplier = gauss[currentRow][firstCol].copy();
          for(int col = firstCol; col < gauss[currentRow].length; col++) {
            RationalNumber subtrahent = gauss[row][col].times(multiplier);
            gauss[currentRow][col] = gauss[currentRow][col].minus(subtrahent);
          }
        }
      }
    }
View Full Code Here

Examples of de.lmu.ifi.dbs.elki.data.RationalNumber

   */
  private final RationalNumber[][] exactGaussElimination() {
    final RationalNumber[][] gauss = new RationalNumber[elements.length][this.columndimension];
    for(int row = 0; row < elements.length; row++) {
      for(int col = 0; col < this.columndimension; col++) {
        gauss[row][col] = new RationalNumber(elements[row][col]);
      }
    }
    return exactGaussElimination(gauss);
  }
View Full Code Here

Examples of de.lmu.ifi.dbs.elki.data.RationalNumber

        System.arraycopy(row, 0, gauss[0], 0, row.length);
      }

      // 3. create leading 1
      if(!gauss[0][firstCol].equals(RationalNumber.ONE)) {
        final RationalNumber inverse = gauss[0][firstCol].multiplicativeInverse();
        for(int col = 0; col < gauss[0].length; col++) {
          gauss[0][col] = gauss[0][col].times(inverse);
        }
      }

      // 4. eliminate values unequal to zero below leading 1
      for(int row = 1; row < gauss.length; row++) {
        final RationalNumber multiplier = gauss[row][firstCol].copy();
        // if(multiplier != 0.0)
        if(!multiplier.equals(RationalNumber.ZERO)) {
          for(int col = firstCol; col < gauss[row].length; col++) {
            final RationalNumber subtrahent = gauss[0][col].times(multiplier);
            gauss[row][col] = gauss[row][col].minus(subtrahent);
          }
        }
      }
View Full Code Here

Examples of freemarker.ext.beans.RationalNumber

    public BigInteger bigInteger(BigDecimal n) {
        return n.toBigInteger();
    }

    public RationalNumber rational(int a, int b) {
        return new RationalNumber(a, b);
    }
View Full Code Here

Examples of jmathexpr.arithmetic.rational.RationalNumber

    }
   
    @Test(dependsOnMethods = { "testVariables" })
    public void testRationalExpressions() {
        Expression evaluated;
        RationalNumber oneHalf = new LongRationalNumber(1, 2);
        RationalNumber oneThird = new LongRationalNumber(1, 3);
        Expression sum = new Addition(oneHalf, oneThird);
       
        evaluated = sum.evaluate();
        System.out.printf("%s = %s%n", sum, evaluated);
        assertEquals(evaluated, new LongRationalNumber(5, 6));
       
        Expression difference = new Subtraction(oneHalf, oneThird);
        evaluated = difference.evaluate();
        System.out.printf("%s = %s%n", difference, evaluated);
        assertEquals(evaluated, new LongRationalNumber(1, 6));
       
        RationalNumber sixEighth = new LongRationalNumber(6, 8);
        evaluated = sixEighth.evaluate();
        System.out.printf("%s = %s%n", sixEighth, evaluated);
        assertEquals(evaluated, new LongRationalNumber(3, 4));
       
        difference = new Subtraction(new LongRationalNumber(2, 3), new LongRationalNumber(1, 6));
        evaluated = difference.evaluate();
View Full Code Here

Examples of org.apache.commons.imaging.common.RationalNumber

            return ByteConversions.toBytes((RationalNumber) o, byteOrder);
        } else if (o instanceof RationalNumber[]) {
            return ByteConversions.toBytes((RationalNumber[]) o, byteOrder);
        } else if (o instanceof Number) {
            final Number number = (Number) o;
            final RationalNumber rationalNumber = RationalNumber.valueOf(number.doubleValue());
            return ByteConversions.toBytes(rationalNumber, byteOrder);
        } else if (o instanceof Number[]) {
            final Number[] numbers = (Number[]) o;
            final RationalNumber[] rationalNumbers = new RationalNumber[numbers.length];
            for (int i = 0; i < numbers.length; i++) {
View Full Code Here

Examples of org.apache.commons.imaging.common.RationalNumber

        if (latitude.length != 3 || longitude.length != 3) {
            throw new ImageReadException("Expected three values for latitude and longitude.");
        }

        final RationalNumber latitudeDegrees = latitude[0];
        final RationalNumber latitudeMinutes = latitude[1];
        final RationalNumber latitudeSeconds = latitude[2];

        final RationalNumber longitudeDegrees = longitude[0];
        final RationalNumber longitudeMinutes = longitude[1];
        final RationalNumber longitudeSeconds = longitude[2];

        return new GPSInfo(latitudeRef, longitudeRef, latitudeDegrees,
                latitudeMinutes, latitudeSeconds, longitudeDegrees,
                longitudeMinutes, longitudeSeconds);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.