public void GetLeftColumnTest()
 {
   ComplexFloatLevinson cfl = new ComplexFloatLevinson(LC5, TR5);
   ComplexFloatVector LC = cfl.GetLeftColumn();
   Assert.IsTrue(LC5.Equals(LC));
 }
 public void MismatchVectorLengthTestsforConstructor1()
 {
   ComplexFloatLevinson cfl = new ComplexFloatLevinson(LC2, TR3);
 }
 public void FirstElementTestforConstructor1()
 {
   ComplexFloatVector cfv = new ComplexFloatVector(3, ComplexFloat.One);
   ComplexFloatLevinson cfl = new ComplexFloatLevinson(LC3, cfv);
 }
 public void NullParameterTestforConstructor2()
 {
   ComplexFloatLevinson cfl = new ComplexFloatLevinson(LC5, null as ComplexFloatVector);
 }
 public void ZeroLengthVectorTestsforConstructor1()
 {
   ComplexFloatVector cfv = new ComplexFloatVector(1);
   cfv.RemoveAt(0);
   ComplexFloatLevinson cfl = new ComplexFloatLevinson(cfv, cfv);
 }
 public void OrderPropertyTest()
 {
   ComplexFloatLevinson cfl = new ComplexFloatLevinson(LC5, TR5);
   Assert.IsTrue(cfl.Order == 5);
 }
    public void SingularityPropertyTest2()
    {
      ComplexFloatVector LC = new ComplexFloatVector(4);
      LC[0] = new ComplexFloat(4.0f);
      LC[1] = new ComplexFloat(2.0f);
      LC[2] = new ComplexFloat(1.0f);
      LC[3] = new ComplexFloat(0.0f);

      ComplexFloatVector TR = new ComplexFloatVector(4);
      TR[0] = new ComplexFloat(4.0f);
      TR[1] = new ComplexFloat(8.0f);
      TR[2] = new ComplexFloat(2.0f);
      TR[3] = new ComplexFloat(1.0f);

      ComplexFloatLevinson cfl = new ComplexFloatLevinson(LC,TR);
      Assert.IsTrue(cfl.IsSingular);
    }
 public void MismatchRowsTestforSolveMatrix()
 {
   ComplexFloatLevinson cfl = new ComplexFloatLevinson(LC10, TR10);
   ComplexFloatMatrix X = cfl.Solve(I5);
 }
    public void SolveMatrix5()
    {
      int i, j;
      float e, me;
      ComplexFloatLevinson cfl = new ComplexFloatLevinson(LC5, TR5);

      // check inverse
      ComplexFloatMatrix I = cfl.Solve(ComplexFloatMatrix.CreateIdentity(5));
      me = 0.0f;
      for (i = 0; i < cfl.Order; i++)
      {
        for (j = 0; j < cfl.Order; j++)
        {
          e = ComplexMath.Absolute((I5[i, j] - I[i, j]) / I5[i, j]);
          if (e > me)
          {
            me = e;
          }
        }
      }
      Assert.IsTrue(me < Tolerance5, "Maximum Error = " + me.ToString());
    }
 public void SolveVector10()
 {
   int i;
   float e, me;
   ComplexFloatLevinson cfl = new ComplexFloatLevinson(LC10, TR10);
   ComplexFloatVector X = cfl.Solve(Y10);
   
   // determine the maximum error
   me = 0.0f;
   for (i = 0; i < cfl.Order; i++)
   {
     e = ComplexMath.Absolute((X10[i] - X[i]) / X10[i]);
     if (e > me)
     {
       me = e;
     }
   }
   Assert.IsTrue(me < Tolerance10, "Maximum Error = " + me.ToString());
 }
 public void NullParameterTestforSolveMatrix()
 {
   ComplexFloatLevinson cfl = new ComplexFloatLevinson(LC10, TR10);
   ComplexFloatMatrix X = cfl.Solve(null as ComplexFloatMatrix);
 }
 public void MismatchRowsTestforSolveVector()
 {
   ComplexFloatLevinson cfl = new ComplexFloatLevinson(LC10, TR10);
   ComplexFloatVector X = cfl.Solve(X5);
 }
 public void NullParameterTestforSolveVector()
 {
   ComplexFloatLevinson cfl = new ComplexFloatLevinson(LC10, TR10);
   ComplexFloatVector X = cfl.Solve(null as ComplexFloatVector);
 }
    public void GetDeterminantMethodTest10()
    {
      // calculate determinant from diagonal
      ComplexFloatLevinson cfl = new ComplexFloatLevinson(LC10, TR10);

      // check results match
      Double e = ComplexMath.Absolute((cfl.GetDeterminant() - Det10)/Det10);
      Assert.IsTrue(e < Tolerance10);
    }
 public void GetTopRowTest()
 {
   ComplexFloatLevinson cfl = new ComplexFloatLevinson(LC5, TR5);
   ComplexFloatVector TR = cfl.GetTopRow();
   Assert.IsTrue(TR5.Equals(TR));
 }
    public void GetInverse10()
    {
      int i, j;
      float e, me;
      ComplexFloatLevinson cfl = new ComplexFloatLevinson(LC10, TR10);

      // check inverse
      ComplexFloatMatrix I = cfl.GetInverse();
      me = 0.0f;
      for (i = 0; i < cfl.Order; i++)
      {
        for (j = 0; j < cfl.Order; j++)
        {
          e = ComplexMath.Absolute((I10[i, j] - I[i, j]) / I10[i, j]);
          if (e > me)
          {
            me = e;
          }
        }
      }
      Assert.IsTrue(me < Tolerance10, "Maximum Error = " + me.ToString());
    }
 public void GetMatrixMemberTest()
 {
   ComplexFloatLevinson cfl = new ComplexFloatLevinson(LC5, TR5);
   ComplexFloatMatrix cflfm = cfl.GetMatrix();
   for (int row = 0; row < TR5.Length; row++)
   {
     for (int column = 0; column < TR5.Length; column++)
     {
       if (column < row)
       {
         Assert.IsTrue(cflfm[row, column] == LC5[row - column]);
       }
       else
       {
         Assert.IsTrue(cflfm[row, column] == TR5[column - row]);
       }
     }
   }
 }
 public void NullParameterTestforConstructor1()
 {
   ComplexFloatLevinson cfl = new ComplexFloatLevinson(null as ComplexFloatVector, TR5);
 }
    public void DecompositionTest3()
    {
      int i, j;
      float e, me;
      ComplexFloatLevinson cfl = new ComplexFloatLevinson(LC3, TR3);
      ComplexFloatMatrix U = cfl.U;
      ComplexFloatMatrix D = cfl.D;
      ComplexFloatMatrix L = cfl.L;
      
      // check the upper triangle
      me = 0.0f;
      for (i = 0; i < cfl.Order; i++)
      {
        for (j = 0; j < cfl.Order; j++)
        {
          if (U3[i, j] != U[i, j])
          {
            e = ComplexMath.Absolute((U3[i, j] - U[i, j]) / U3[i, j]);
            if (e > me)
            {
              me = e;
            }
          }
        }
      }
      Assert.IsTrue(me < Tolerance3, "Maximum Error = " + me.ToString());

      // check the lower triangle
      me = 0.0f;
      for (i = 0; i < cfl.Order; i++)
      {
        for (j = 0; j < cfl.Order; j++)
        {
          if (L3[i, j] != L[i, j])
          {
            e = ComplexMath.Absolute((L3[i, j] - L[i, j]) / L3[i, j]);
            if (e > me)
            {
              me = e;
            }
          }
        }
      }
      Assert.IsTrue(me < Tolerance3, "Maximum Error = " + me.ToString());

      // check the diagonal
      me = 0.0f;
      for (i = 0; i < cfl.Order; i++)
      {
        e = ComplexMath.Absolute((D3[i] - D[i, i]) / D3[i]);
        if (e > me)
        {
          me = e;
        }
      }

      Assert.IsTrue(me < Tolerance3, "Maximum Error = " + me.ToString());
    }
 public void SingularityPropertyTest1()
 {
   ComplexFloatLevinson cfl = new ComplexFloatLevinson(LC4,TR4);
   Assert.IsFalse(cfl.IsSingular);
 }