コード例 #1
0
  public void estimate(final Access1D<?> x, final Access1D<?> y) {

    final int tmpRowDim = (int) Math.min(x.count(), y.count());
    final int tmpColDim = this.size();

    final PhysicalStore<ComplexNumber> tmpBody =
        ComplexDenseStore.FACTORY.makeZero(tmpRowDim, tmpColDim);
    final PhysicalStore<ComplexNumber> tmpRHS = ComplexDenseStore.FACTORY.makeZero(tmpRowDim, 1);

    for (int i = 0; i < tmpRowDim; i++) {

      ComplexNumber tmpX = ComplexNumber.ONE;
      final ComplexNumber tmpXfactor = ComplexNumber.valueOf((Number) x.get(i));
      final ComplexNumber tmpY = ComplexNumber.valueOf((Number) y.get(i));

      for (int j = 0; j < tmpColDim; j++) {
        tmpBody.set(i, j, tmpX);
        tmpX = tmpX.multiply(tmpXfactor);
      }
      tmpRHS.set(i, 0, tmpY);
    }

    final QR<ComplexNumber> tmpQR = QR.makeComplex();
    tmpQR.decompose(tmpBody);
    this.set(tmpQR.solve(tmpRHS));
  }
コード例 #2
0
ファイル: TestUtils.java プロジェクト: ddrummond/ojAlgo
 public static void assertEquals(
     final String message,
     final Access1D<?> expected,
     final Access1D<?> actual,
     final NumberContext context) {
   for (long i = 0; i < expected.count(); i++) {
     TestUtils.assertEquals(message + " @ " + i, expected.get(i), actual.get(i), context);
   }
 }
コード例 #3
0
 public void set(final Access1D<?> someCoefficient) {
   final int tmpLimit = (int) Math.min(this.size(), someCoefficient.count());
   for (int p = 0; p < tmpLimit; p++) {
     this.set(p, ComplexNumber.valueOf((Number) someCoefficient.get(p)));
   }
 }