本文整理匯總了Java中org.apache.commons.math3.complex.Complex.multiply方法的典型用法代碼示例。如果您正苦於以下問題:Java Complex.multiply方法的具體用法?Java Complex.multiply怎麽用?Java Complex.multiply使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.commons.math3.complex.Complex
的用法示例。
在下文中一共展示了Complex.multiply方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: otherSide
import org.apache.commons.math3.complex.Complex; //導入方法依賴的package包/類
public SV otherSide(float r, float x, float g, float b, float ratio) {
Complex z = new Complex(r, x); // z=r+jx
Complex y = new Complex(g, b); // y=g+jb
Complex s1 = new Complex(p, q); // s1=p1+jq1
Complex u1 = ComplexUtils.polar2Complex(u, Math.toRadians(a));
Complex v1 = u1.divide(Math.sqrt(3f)); // v1=u1/sqrt(3)
Complex v1p = v1.multiply(ratio); // v1p=v1*rho
Complex i1 = s1.divide(v1.multiply(3)).conjugate(); // i1=conj(s1/(3*v1))
Complex i1p = i1.divide(ratio); // i1p=i1/rho
Complex i2 = i1p.subtract(y.multiply(v1p)); // i2=i1p-y*v1p
Complex v2 = v1p.subtract(z.multiply(i2)); // v2=v1p-z*i2
Complex s2 = v2.multiply(3).multiply(i2.conjugate()); // s2=3*v2*conj(i2)
Complex u2 = v2.multiply(Math.sqrt(3f));
return new SV((float) -s2.getReal(), (float) -s2.getImaginary(), (float) u2.abs(), (float) Math.toDegrees(u2.getArgument()));
}
示例2: calculateZernikeMoment
import org.apache.commons.math3.complex.Complex; //導入方法依賴的package包/類
/**
* Compute Zernike moments at specified order.
*
* @param w Width of the bounding box of the shape.
* @param h Height of the bounding box of the shape.
* @param n 1st order of the moment.
* @param m 2nd order of the moment.
*
* @return Zernike moment of data in f[][].
*/
public static Complex calculateZernikeMoment(double[][] f, int w, int h, int n, int m){
int diff = n-Math.abs(m);
if ((n<0) || (Math.abs(m) > n) || (diff%2!=0)){
throw new IllegalArgumentException("zer_mom: n="+n+", m="+m+", n-|m|="+diff);
}
final double c = -1;
final double d = 1;
ZernikeBasisFunction zernike = new ZernikeBasisFunction(n,m);
Complex res = new Complex(0.0, 0.0);
for (int i=0;i<w;i++){
for (int j=0;j<h;j++) {
Complex v = new Complex(c+(i*(d-c))/(w-1), d-(j*(d-c))/(h-1));
res = res.add(zernike.value(v).conjugate().multiply(f[i][j]));
}
}
return res.multiply((n+1)/Math.PI);
}
示例3: product
import org.apache.commons.math3.complex.Complex; //導入方法依賴的package包/類
private Complex product() {
Complex lhs = power();
while (current.type == Token.Type.MUL ||
current.type == Token.Type.DIV)
if (current.type == Token.Type.MUL) {
eat(Token.Type.MUL);
lhs = lhs.multiply(power());
} else {
eat(Token.Type.DIV);
lhs = lhs.divide(power());
}
return lhs;
}
示例4: toSv2
import org.apache.commons.math3.complex.Complex; //導入方法依賴的package包/類
public StateVariable toSv2(StateVariable sv1) {
Complex s1 = new Complex(-sv1.p, -sv1.q); // s1=p1+jq1
Complex u1 = ComplexUtils.polar2Complex(sv1.u, Math.toRadians(sv1.theta));
Complex v1 = u1.divide(SQUARE_3); // v1=u1/sqrt(3)
Complex v1p = v1.multiply(ratio); // v1p=v1*rho
Complex i1 = s1.divide(v1.multiply(3)).conjugate(); // i1=conj(s1/(3*v1))
Complex i1p = i1.divide(ratio); // i1p=i1/rho
Complex i2 = i1p.subtract(y.multiply(v1p)).negate(); // i2=-(i1p-y*v1p)
Complex v2 = v1p.subtract(z.multiply(i2)); // v2=v1p-z*i2
Complex s2 = v2.multiply(3).multiply(i2.conjugate()); // s2=3*v2*conj(i2)
Complex u2 = v2.multiply(SQUARE_3);
return new StateVariable(-s2.getReal(), -s2.getImaginary(), u2.abs(), Math.toDegrees(u2.getArgument()));
}
示例5: toSv1
import org.apache.commons.math3.complex.Complex; //導入方法依賴的package包/類
public StateVariable toSv1(StateVariable sv2) {
Complex s2 = new Complex(-sv2.p, -sv2.q); // s2=p2+jq2
Complex u2 = ComplexUtils.polar2Complex(sv2.u, Math.toRadians(sv2.theta));
Complex v2 = u2.divide(SQUARE_3); // v2=u2/sqrt(3)
Complex i2 = s2.divide(v2.multiply(3)).conjugate(); // i2=conj(s2/(3*v2))
Complex v1p = v2.add(z.multiply(i2)); // v1'=v2+z*i2
Complex i1p = i2.negate().add(y.multiply(v1p)); // i1'=-i2+v1'*y
Complex i1 = i1p.multiply(ratio); // i1=i1p*ration
Complex v1 = v1p.divide(ratio); // v1=v1p/ration
Complex s1 = v1.multiply(3).multiply(i1.conjugate()); // s1=3*v1*conj(i1)
Complex u1 = v1.multiply(SQUARE_3);
return new StateVariable(-s1.getReal(), -s1.getImaginary(), u1.abs(), Math.toDegrees(u1.getArgument()));
}