Exemplo n.º 1
0
 // Converts a phasor matrix (PhasorMatix) to a complex matrix (ComplexMatrix) - static method
 public static ComplexMatrix toComplexMatrix(PhasorMatrix pp) {
   int nr = pp.getNrow();
   int nc = pp.getNcol();
   ComplexMatrix cc = new ComplexMatrix(nr, nc);
   for (int i = 0; i < nr; i++) {
     for (int j = 0; j < nc; i++) {
       cc.setElement(i, j, pp.matrix[i][j].toRectangular());
     }
   }
   return cc;
 }
Exemplo n.º 2
0
 // COPY
 // Copy a PhasorMatrix [static method]
 public static PhasorMatrix copy(PhasorMatrix a) {
   if (a == null) {
     return null;
   } else {
     int nr = a.getNrow();
     int nc = a.getNcol();
     Phasor[][] aarray = a.getArrayReference();
     PhasorMatrix b = new PhasorMatrix(nr, nc);
     b.nrow = nr;
     b.ncol = nc;
     Phasor[][] barray = b.getArrayReference();
     for (int i = 0; i < nr; i++) {
       for (int j = 0; j < nc; j++) {
         barray[i][j] = Phasor.copy(aarray[i][j]);
       }
     }
     for (int i = 0; i < nr; i++) b.index[i] = a.index[i];
     return b;
   }
 }