@Override
 public IComplexNumber rdivi(Number v, IComplexNumber result) {
   float d =
       result.realComponent().floatValue() * result.realComponent().floatValue()
           + result.imaginaryComponent().floatValue() * result.imaginaryComponent().floatValue();
   return result.set(
       v.floatValue() * result.realComponent().floatValue() / d,
       -v.floatValue() * result.imaginaryComponent().floatValue() / d);
 }
 /**
  * Multiply two complex numbers, inplace
  *
  * @param c
  * @param result
  */
 @Override
 public IComplexNumber muli(IComplexNumber c, IComplexNumber result) {
   float newR =
       realComponent() * c.realComponent().floatValue()
           - imaginaryComponent() * c.imaginaryComponent().floatValue();
   float newI =
       realComponent() * c.imaginaryComponent().floatValue()
           + imaginaryComponent() * c.realComponent().floatValue();
   return result.set(newR, newI);
 }
 /**
  * Divide two complex numbers, in-place
  *
  * @param c
  * @param result
  */
 @Override
 public IComplexNumber divi(IComplexNumber c, IComplexNumber result) {
   float d =
       c.realComponent().floatValue() * c.realComponent().floatValue()
           + c.imaginaryComponent().floatValue() * c.imaginaryComponent().floatValue();
   float newR =
       (realComponent() * c.realComponent().floatValue()
               + imaginaryComponent() * c.imaginaryComponent().floatValue())
           / d;
   float newI =
       (imaginaryComponent() * c.realComponent().floatValue()
               - realComponent() * c.imaginaryComponent().floatValue())
           / d;
   return result.set(newR, newI);
 }
 @Override
 public IComplexNumber divi(Number v, IComplexNumber result) {
   return result.set(
       result.realComponent().floatValue() / v.floatValue(),
       result.imaginaryComponent().floatValue() / v.floatValue());
 }
 @Override
 public IComplexNumber subi(Number a, IComplexNumber result) {
   return result.set(result.realComponent().floatValue() - a.floatValue(), imaginaryComponent());
 }
 /**
  * Add two complex numbers in-place
  *
  * @param c
  * @param result
  */
 @Override
 public IComplexNumber addi(IComplexNumber c, IComplexNumber result) {
   return result.set(
       result.realComponent().floatValue() + c.realComponent().floatValue(),
       result.imaginaryComponent().floatValue() + c.imaginaryComponent().floatValue());
 }
 @Override
 public IComplexNumber rdivi(IComplexNumber c, IComplexNumber result) {
   return result.set(c.div(this));
 }
 @Override
 public IComplexNumber rsubi(Number a, IComplexNumber result) {
   return result.set(a.doubleValue() - realComponent().doubleValue(), imaginaryComponent());
 }
 @Override
 public IComplexNumber rsubi(IComplexNumber a, IComplexNumber result) {
   return result.set(a.sub(this));
 }
Exemple #10
0
 @Override
 public IComplexNumber muli(Number v, IComplexNumber result) {
   return result.set(
       realComponent().floatValue() * v.floatValue(),
       imaginaryComponent().floatValue() * v.floatValue());
 }