當前位置: 首頁>>代碼示例>>Java>>正文


Java Complex.getImaginary方法代碼示例

本文整理匯總了Java中org.apache.commons.math3.complex.Complex.getImaginary方法的典型用法代碼示例。如果您正苦於以下問題:Java Complex.getImaginary方法的具體用法?Java Complex.getImaginary怎麽用?Java Complex.getImaginary使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.math3.complex.Complex的用法示例。


在下文中一共展示了Complex.getImaginary方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getNetOutput

import org.apache.commons.math3.complex.Complex; //導入方法依賴的package包/類
@Override
public double[] getNetOutput() {
	int i = 3;
	double[] output = new double[2 * i];

	Complex power = getAclfNet().getBranch("Bus5->Bus6(1)").powerFrom2To();
	output[0] = power.getReal();
	output[1] = power.getImaginary();
	power = getAclfNet().getBranch("Bus4->Bus7(1)").powerFrom2To();
	output[2] = power.getReal();
	output[3] = power.getImaginary();
	power = getAclfNet().getBranch("Bus4->Bus9(1)").powerFrom2To();
	output[4] = power.getReal();
	output[5] = power.getImaginary();
	return output;
}
 
開發者ID:interpss,項目名稱:DeepMachineLearning,代碼行數:17,代碼來源:InterfacePowerRandomChangeTrainCaseBuilder.java

示例2: 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()));
}
 
開發者ID:powsybl,項目名稱:powsybl-core,代碼行數:18,代碼來源:SV.java

示例3: isComplexNumber

import org.apache.commons.math3.complex.Complex; //導入方法依賴的package包/類
static boolean isComplexNumber(String value) {
	
	boolean isComplex = true;
	Complex complex=null;
	try {
		DecimalFormat df = (DecimalFormat)NumberFormat.getNumberInstance(Locale.US);
		df.setGroupingUsed(false);
		
		// Numerical format ###.## (decimal symbol is the point)
		ComplexFormat complexFormat = new ComplexFormat(df);
		complex = complexFormat.parse(value);

	// This is because there is a bug parsing complex number. 9i is parsed as 9
		if (complex.getImaginary() == 0 && value.contains("i")) isComplex = false;
	} catch (Exception e) {
		isComplex = false;
	}

return isComplex;
}
 
開發者ID:sakaiproject,項目名稱:sakai,代碼行數:21,代碼來源:FinQuestionValidator.java

示例4: setComplexValue

import org.apache.commons.math3.complex.Complex; //導入方法依賴的package包/類
public ValueType setComplexValue(Complex c)
{
    real = c.getReal();
    imaginary = c.getImaginary();
    valueType = (imaginary != 0.0) ? ValueType.COMPLEX : ValueType.REAL;
    return valueType;
}
 
開發者ID:mkulesh,項目名稱:microMathematics,代碼行數:8,代碼來源:CalculatedValue.java

示例5: complexOperate

import org.apache.commons.math3.complex.Complex; //導入方法依賴的package包/類
@Override
public void complexOperate(double[] out, double ra, double ia, double rb, double ib) {
	Complex c = new Complex(ra, ia);
	c = ib == 0 ? c.pow(rb) : c.pow(new Complex(rb, ib));
	out[0] = c.getReal();
	out[1] = c.getImaginary();
}
 
開發者ID:eclipse,項目名稱:january,代碼行數:8,代碼來源:Operations.java

示例6: 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()));
}
 
開發者ID:itesla,項目名稱:ipst,代碼行數:14,代碼來源:TransformerModel.java

示例7: 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()));
}
 
開發者ID:itesla,項目名稱:ipst,代碼行數:14,代碼來源:TransformerModel.java

示例8: getValue

import org.apache.commons.math3.complex.Complex; //導入方法依賴的package包/類
/*********************************************************
 * Re-implementation for methods for FormulaBase and FormulaTerm superclass's
 *********************************************************/

@Override
public CalculatedValue.ValueType getValue(CalculaterTask thread, CalculatedValue outValue) throws CancelException
{
    if (getFormulaRoot() instanceof Equation)
    {
        Equation eq = (Equation) getFormulaRoot();
        final int argNumber = eq.getArguments() != null ? eq.getArguments().size() : 0;
        String strValue = null;
        if (argNumber == 1 || argNumber == 2)
        {
            final int a0 = eq.getArgumentValue(0).getInteger();
            if (a0 < fileBuffer.size())
            {
                final ArrayList<String> line = fileBuffer.get(a0);
                final int a1 = (argNumber == 1) ? 0 : eq.getArgumentValue(1).getInteger();
                if (a1 < line.size())
                {
                    strValue = line.get(a1);
                }
            }
        }
        if (strValue != null)
        {
            try
            {
                return outValue.setValue(Double.parseDouble(strValue));
            }
            catch (Exception ex)
            {
                // nothing to do: we will try to convert it to complex
            }
            Complex cmplValue = TermParser.complexValueOf(strValue);
            if (cmplValue != null)
            {
                if (cmplValue.getImaginary() != 0.0)
                {
                    return outValue.setComplexValue(cmplValue.getReal(), cmplValue.getImaginary());
                }
                else
                {
                    return outValue.setValue(cmplValue.getReal());
                }
            }
        }
        return outValue.invalidate(CalculatedValue.ErrorType.NOT_A_NUMBER);
    }
    return outValue.invalidate(CalculatedValue.ErrorType.TERM_NOT_READY);
}
 
開發者ID:mkulesh,項目名稱:microMathematics,代碼行數:53,代碼來源:FormulaTermFileOperation.java

示例9: UseIfEqualTo

import org.apache.commons.math3.complex.Complex; //導入方法依賴的package包/類
/**
 * @param z
 *            given value as Complex
 */
public UseIfEqualTo(Complex z) {
	super(z.getReal());
	di = z.getImaginary();
}
 
開發者ID:eclipse,項目名稱:january,代碼行數:9,代碼來源:Operations.java

示例10: interpret

import org.apache.commons.math3.complex.Complex; //導入方法依賴的package包/類
public Complex interpret() {
	Complex value = sum();
	
	if (current.type != Token.Type.END)
		throw new RuntimeException("Given expression has an invalid syntax");
	
	double real = value.getReal(), imag = value.getImaginary();
	
	real = Tools.round(real);
	imag = Tools.round(imag);
	
	return new Complex(real, imag);
}
 
開發者ID:QwertygidQ,項目名稱:DeutschSim,代碼行數:14,代碼來源:Interpreter.java

示例11: createRealImaginaryArray

import org.apache.commons.math3.complex.Complex; //導入方法依賴的package包/類
/**
 * Builds a new two dimensional array of {@code double} filled with the real
 * and imaginary parts of the specified {@link Complex} numbers. In the
 * returned array {@code dataRI}, the data is laid out as follows
 * <ul>
 * <li>{@code dataRI[0][i] = dataC[i].getReal()},</li>
 * <li>{@code dataRI[1][i] = dataC[i].getImaginary()}.</li>
 * </ul>
 *
 * @param dataC the array of {@link Complex} data to be transformed
 * @return a two dimensional array filled with the real and imaginary parts
 *   of the specified complex input
 */
public static double[][] createRealImaginaryArray(final Complex[] dataC) {
    final double[][] dataRI = new double[2][dataC.length];
    final double[] dataR = dataRI[0];
    final double[] dataI = dataRI[1];
    for (int i = 0; i < dataC.length; i++) {
        final Complex c = dataC[i];
        dataR[i] = c.getReal();
        dataI[i] = c.getImaginary();
    }
    return dataRI;
}
 
開發者ID:biocompibens,項目名稱:SME,代碼行數:25,代碼來源:TransformUtils.java

示例12: getMismatch

import org.apache.commons.math3.complex.Complex; //導入方法依賴的package包/類
/**
 * compute and return the mismatch based on the network solution 
 * for bus voltage
 * 
 * @param netVolt network bus voltage solution
 * @return mismatch info string
 */
public double[] getMismatch(double[] netVolt) {
	Complex maxMis= this.trainCaseBuilder.calMismatch(netVolt).maxMis;
	return new double[] {maxMis.getReal(),maxMis.getImaginary()};
}
 
開發者ID:interpss,項目名稱:DeepMachineLearning,代碼行數:12,代碼來源:AclfPyGateway.java


注:本文中的org.apache.commons.math3.complex.Complex.getImaginary方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。