test_class.file: jtstoolkit/src/test/java/ec/tstoolkit/maths/polynomials/LeastSquaresDivisionTest.java
test_class.identifier: LeastSquaresDivisionTest
test_case.body: @Test
      public void testDivision() {
          int q=10, d=20;
          DataBlock Q=new DataBlock(q), D=new DataBlock(d);
          Q.randomize(0);
          D.randomize(1);
          Polynomial pq=Polynomial.copyOf(Q.getData());
          Polynomial pd=Polynomial.copyOf(D.getData());
          Polynomial pn=pd.times(pq);
          LeastSquaresDivision div=new LeastSquaresDivision();
          div.divide(pn, pd);
  //        if (div.isExact()){
  //             DataBlock Q2=new DataBlock(div.getQuotient());
  //             System.out.println(Q2.distance(Q));
  //        }
      }
test_case.class_method_signature: LeastSquaresDivisionTest.testDivision()
test_case.full_signature: @Test public void testDivision()
test_case.identifier: testDivision
test_case.invocations: randomize randomize copyOf getData copyOf getData times divide
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testDivision()
focal_class.declarator: EPS = 1e-9
focal_class.modifier: public static final
focal_class.original_string: public static final double EPS = 1e-9;
focal_class.type: double
focal_class.var_name: EPS
focal_class.declarator: err_
focal_class.modifier: private
focal_class.original_string: private double err_;
focal_class.type: double
focal_class.var_name: err_
focal_class.declarator: coeff
focal_class.modifier: private
focal_class.original_string: private double[] coeff;
focal_class.type: double[]
focal_class.var_name: coeff
focal_class.file: jtstoolkit/src/main/java/ec/tstoolkit/maths/polynomials/LeastSquaresDivision.java
focal_class.identifier: LeastSquaresDivision
focal_class.class_method_signature: LeastSquaresDivision.divide(Polynomial num, Polynomial denom)
focal_class.full_signature: public boolean divide(Polynomial num, Polynomial denom)
focal_class.identifier: divide
focal_class.modifiers: public
focal_class.parameters: (Polynomial num, Polynomial denom)
focal_class.return: boolean
focal_class.signature: boolean divide(Polynomial num, Polynomial denom)
focal_class.class_method_signature: LeastSquaresDivision.getQuotient()
focal_class.full_signature: public Polynomial getQuotient()
focal_class.identifier: getQuotient
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Polynomial
focal_class.signature: Polynomial getQuotient()
focal_class.class_method_signature: LeastSquaresDivision.getError()
focal_class.full_signature: public double getError()
focal_class.identifier: getError
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: double
focal_class.signature: double getError()
focal_class.class_method_signature: LeastSquaresDivision.isExact()
focal_class.full_signature: public boolean isExact()
focal_class.identifier: isExact
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isExact()
focal_method.body: public boolean divide(Polynomial num, Polynomial denom) {
          try {
              err_ = 0;
              DataBlock N = new DataBlock(num);
              DataBlock D = new DataBlock(denom);
              int n = N.getLength(), d = D.getLength();
              if (d > n) {
                  return false;
              }
              int q = n - d + 1;
              coeff = new double[q];
              Matrix m = new Matrix(n, q);
              DataBlockIterator columns = m.columns();
              DataBlock column = columns.getData();
              int c = 0;
              do {
                  column.range(c, c + d).copy(D);
                  ++c;
              } while (columns.next());
              Householder qr = new Householder(false);
              qr.decompose(m);
              DataBlock E = new DataBlock(d - 1);
              qr.leastSquares(N, new DataBlock(coeff), E);
              this.err_ = E.nrm2() / d;
              return true;
          } catch (MatrixException err) {
              return false;
          }
      }
focal_method.class_method_signature: LeastSquaresDivision.divide(Polynomial num, Polynomial denom)
focal_method.full_signature: public boolean divide(Polynomial num, Polynomial denom)
focal_method.identifier: divide
focal_method.invocations: getLength getLength columns getData copy range next decompose leastSquares nrm2
focal_method.modifiers: public
focal_method.parameters: (Polynomial num, Polynomial denom)
focal_method.return: boolean
focal_method.signature: boolean divide(Polynomial num, Polynomial denom)