Exemplo n.º 1
0
 @Override
 public IMatrix times(double n) {
   if (this instanceof JsComplexMatrix) {
     return new JsComplexMatrix(((ComplexMatrix) matrix).times(Complex.valueOf(n, 0)));
   } else {
     return new JsRealMatrix(((Float64Matrix) matrix).times(Float64.valueOf(n)));
   }
 }
Exemplo n.º 2
0
  // Follows Pedrotti Eq. 19-36
  // Eq. 19-44 exclusively for phase difference across quarter thickness
  public Complex getReflectionCoefficient() {
    Complex gamma0 = Complex.valueOf(gammas[0], 0);
    Complex gammaS = Complex.valueOf(gammas[gammas.length - 1], 0);
    Complex m11 = transfer.get(0, 0);
    Complex m12 = transfer.get(0, 1);
    Complex m21 = transfer.get(1, 0);
    Complex m22 = transfer.get(1, 1);

    // Pedrotti, Eq. 19-36
    //  Complex r = (g0m11+g0gSm12-m21-gSm22)/(g0m11+g0gSm12+m21+gSm22)
    Complex n1 = gamma0.times(m11);
    Complex n2 = gamma0.times(gammaS).times(m12);
    Complex n3 = m21;
    Complex n4 = gammaS.times(m22);
    Complex numerator = n1.plus(n2).minus(n3).minus(n4);
    Complex denominator = n1.plus(n2).plus(n3).plus(n4);
    Complex r = numerator.divide(denominator);
    return r;
  }
Exemplo n.º 3
0
  protected static JsComplexMatrix makeComplex(JsRealMatrix matrix) {
    Float64Matrix realMatrix = (Float64Matrix) matrix.matrix;
    int m = realMatrix.getRow(0).getDimension();
    int n = realMatrix.getColumn(0).getDimension();

    Complex[][] values = new Complex[m][n];

    for (int i = 0; i < m; i++) {
      for (int j = 0; j < n; j++) {
        values[i][j] = Complex.valueOf(realMatrix.get(i, j).doubleValue(), 0);
      }
    }

    return new JsComplexMatrix(ComplexMatrix.valueOf(values));
  }