package cern.jet.math.tfcomplex;
/**
* Only for performance tuning of compute intensive linear algebraic
* computations. Constructs functions that return one of
*
* - a*constant + b
*
- a*constant - b
*
- a/constant + b
*
- a/constant - b
*
* a and b are variables, constant is fixed, but for
* performance reasons publicly accessible. Intended to be passed to
* matrix.assign(otherMatrix,function) methods.
*/
public class FComplexPlusMultFirst implements cern.colt.function.tfcomplex.FComplexFComplexFComplexFunction {
/**
* Public read/write access to avoid frequent object construction.
*/
public float[] multiplicator;
/**
* Insert the method's description here. Creation date: (8/10/99 19:12:09)
*/
protected FComplexPlusMultFirst(final float[] multiplicator) {
this.multiplicator = multiplicator;
}
/**
* Returns the result of the function evaluation.
*/
public final float[] apply(float[] a, float[] b) {
float[] z = new float[2];
z[0] = a[0] * multiplicator[0] - a[1] * multiplicator[1];
z[1] = a[1] * multiplicator[0] + a[0] * multiplicator[1];
z[0] += b[0];
z[1] += b[1];
return z;
}
/**
* a - b/constant.
*/
public static FComplexPlusMultFirst minusDiv(final float[] constant) {
return new FComplexPlusMultFirst(FComplex.neg(FComplex.inv(constant)));
}
/**
* a - b*constant.
*/
public static FComplexPlusMultFirst minusMult(final float[] constant) {
return new FComplexPlusMultFirst(FComplex.neg(constant));
}
/**
* a + b/constant.
*/
public static FComplexPlusMultFirst plusDiv(final float[] constant) {
return new FComplexPlusMultFirst(FComplex.inv(constant));
}
/**
* a + b*constant.
*/
public static FComplexPlusMultFirst plusMult(final float[] constant) {
return new FComplexPlusMultFirst(constant);
}
}
Ads help maintain this website.