예제 #1
0
 private void updateMatrix() {
   ComplexMatrix[] matrices = new ComplexMatrix[layers.length - 2];
   for (int i = 0; i < matrices.length; i++) {
     Layer[] subset = {layers[i], layers[i + 1], layers[i + 2]};
     matrices[i] = VcselMath.calculateTransferMatrix(source, subset);
   }
   ComplexMatrix overallTransfer = matrices[0];
   for (int i = 1; i < matrices.length; i++) {
     overallTransfer = overallTransfer.times(matrices[i]);
   }
   this.transfer = overallTransfer;
 }
예제 #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;
  }
예제 #3
0
  @Override
  public IMatrix times(IMatrix m) {
    if (m instanceof JsMatrix) {

      if (m instanceof JsComplexMatrix || this instanceof JsComplexMatrix) {
        return new JsComplexMatrix(ComplexMatrix.valueOf(matrix.times(((JsMatrix) m).matrix)));
      } else {
        return new JsRealMatrix(Float64Matrix.valueOf(matrix.times(((JsMatrix) m).matrix)));
      }
    }

    return null;
  }
예제 #4
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));
  }