Examples of Apcomplex


Examples of org.apfloat.Apcomplex

    this(real, Apfloat.ZERO);
  }
 
  public BigDec(Apfloat real, Apfloat complex) {
    infinity = 0;
    internal = new Apcomplex(real, complex);
  }
View Full Code Here

Examples of org.apfloat.Apcomplex

    this(real, 0.0);
  }
 
  public BigDec(double real, double complex) {
    infinity = real == Double.POSITIVE_INFINITY || complex == Double.POSITIVE_INFINITY ? 1 : real == Double.NEGATIVE_INFINITY || complex == Double.NEGATIVE_INFINITY ? -1 : 0;
    internal = infinity == 0 ? new Apcomplex(new Apfloat(real, PRECISION), new Apfloat(complex, PRECISION)) : null;
  }
View Full Code Here

Examples of org.apfloat.Apcomplex

      infinity = 1;
    else if (new Integer(real).doubleValue() == Double.NEGATIVE_INFINITY)
      infinity = -1;
    else
      infinity = 0;
    internal = infinity == 0 ? new Apcomplex(new Apfloat(real, PRECISION), new Apfloat(complex, PRECISION)) : null;
  }
View Full Code Here

Examples of org.apfloat.Apcomplex

      infinity = 1;
    else if (new Long(real).doubleValue() == Double.NEGATIVE_INFINITY)
      infinity = -1;
    else
      infinity = 0;
    internal = infinity == 0 ? new Apcomplex(new Apfloat(real, PRECISION), new Apfloat(complex, PRECISION)) : null;
  }
View Full Code Here

Examples of org.apfloat.Apcomplex

  public BigDec(String number) {
    Matcher m = complexNumber.matcher(number.replaceAll(" ", "").toLowerCase());
    if (!m.matches()) {
      if (number.equals("i")) {
        infinity = 0;
        internal = new Apcomplex(new Apfloat(0, PRECISION), new Apfloat(1, PRECISION));
        return;
      }
      throw new NumberFormatException(number + " is not a valid complex number.");
    }
    Apfloat real = new Apfloat(0, PRECISION), imaginary = new Apfloat(0, PRECISION);
    int sign = 1;
    if ("-".equals(m.group(1)))
      sign = -1;
    if (m.group(2).equals("infinity")) {
      infinity = sign;
      internal = null;
      return;
    }
    if (m.group(2).equals("i")) {
      imaginary = new Apfloat(1, PRECISION);
    }
    else if (m.group(5) != null)
      imaginary = sign == -1 ? new Apfloat("-" + m.group(3), PRECISION) : new Apfloat(m.group(3), PRECISION);
    else
      real = sign == -1 ? new Apfloat("-" + m.group(3), PRECISION) : new Apfloat(m.group(3), PRECISION);
    if (m.group(6) != null) {
      sign = 1;
      if ("-".equals(m.group(7)))
        sign = -1;
      if (m.group(8).equals("infinity")) {
        infinity = sign;
        internal = null;
        return;
      }
      if (m.group(8).equals("i")) {
        imaginary = new Apfloat(1, PRECISION);
      }
      else if (m.group(11) != null)
        imaginary = sign == -1 ? new Apfloat("-" + m.group(9), PRECISION) : new Apfloat(m.group(9), PRECISION);
      else
        real = sign == -1 ? new Apfloat("-" + m.group(9), PRECISION) : new Apfloat(m.group(9), PRECISION);
    }
    infinity = 0;
    internal = new Apcomplex(real, imaginary);
  }
View Full Code Here

Examples of org.apfloat.Apcomplex

      r[direction] = new Pair<Apcomplex, Apcomplex>(q, lastR);
    }
    int lowest = 0;
    for (int i = 0; i < 4; i++) {
      if (i != direction) {
        Apcomplex tempQ = q.add(units[i]), mult = a.multiply(tempQ);
        if (ApcomplexMath.norm(mult).compareTo(norm) <= 0)
          r[i] = new Pair<Apcomplex, Apcomplex>(tempQ, b.subtract(mult));
        else {
          r[i] = null;
          if (lowest == i)
View Full Code Here

Examples of org.apfloat.Apcomplex

    }
    return other;
  }
 
  private BigDec complexGCD(Apcomplex b, Apcomplex a) {
    Apcomplex q = getQ(b, a, ApZERO, ApZERO, -1), mod = b.subtract(q.multiply(a));
    while (!mod.equals(ApZERO)) {
      b = a;
      a = mod;
      q = getQ(b, a, ApZERO, ApZERO, -1);
      mod = b.subtract(q.multiply(a));
    }
    return new BigDec(a);
  }
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.