ComplexFloatLevinson Type

A Levinson solver for square Toeplitz systems of ComplexFloat type.

This class provides members for inverting the Toeplitz matrix (see ComplexFloatLevinson.GetInverse member), calculating the determinant of the matrix (see ComplexFloatLevinson.GetDeterminant property) and solving linear systems associated with the matrix (see ComplexFloatLevinson.Solve members).

The class implements an UDL decomposition of the inverse of the square Toeplitz matrix. The decomposition is based upon Levinson's algorithm. As a consequence, all operations require approximately N squared FLOPS, where N is the matrix order. This is significantly faster than LU factorization, which requires N cubed FLOPS.

One disadvantage of Levinson's algorithm is that all the leading sub-matrices of the Toeplitz matrix must be non-singular. During the decomposition, sub-matrices are checked to ensure that they are non-singular. When a singular matrix is found the decomposition is halted and an interal flag is set. The ComplexFloatLevinson.IsSingular property may be used to access the flag, to determine if any singular matrices were detected.

A outline of this approach to the UDL decomposition of inverse Toeplitz matrices is found in the following reference:

Sun-Yuan Kung and Yu Hen Hu, A Highly Concurrent Algorithm and Pipelined Architecture for Solving Toeplitz Systems, IEEE Transactions on Acoustics, Speech and Signal Processing, Volume ASSP-31, Number 1, Febuary 1983, pages 66 - 75.

This class is optimised for non-symmetric Toeplitz matrices. If you wish to solve a symmetric Toeplitz system, use the class, which is twice as fast as this class.

Copyright (c) 2003-2004, dnAnalytics Project. All rights reserved. See http://www.dnAnalytics.net for details.

Adopted to Altaxo (c) 2005 Dr. Dirk Lellinger.

Example

The following simple example illustrates the use of the class:

             using System;
             using dnA.Exceptions;
             using dnA.Math;
             using System.IO;
            
             namespace Example_12
             {
            
               class Application
               {
                 // application entry point
                 [STAThread]
                 public static void Main(string[] args)
                 {
                   ComplexFloatVector LC = new ComplexFloatVector(3);
                   LC[0] = new ComplexFloat(3.0f, 3.0f);
                   LC[1] = new ComplexFloat(2.0f, 0.0f);
                   LC[2] = new ComplexFloat(1.0f, 1.0f);
            
                   ComplexFloatVector TR = new ComplexFloatVector(3);
                   TR[0] = new ComplexFloat(3.0f, 3.0f);
                   TR[1] = new ComplexFloat(2.0f, 1.0f);
                   TR[2] = new ComplexFloat(1.0f, 0.0f);
            
                   // create levinson solver
                   ComplexFloatLevinson cdl = new ComplexFloatLevinson(LC, TR);
            
                   // display the Toeplitz matrix
                   ComplexFloatMatrix T = cdl.GetMatrix();
                   Console.WriteLine("Matrix:: {0} ", T.ToString("E3"));
                   Console.WriteLine();
            
                   // check if matrix is singular
                   Console.WriteLine("Singular:          {0}", cdl.IsSingular);
            
                   // get the determinant
                   Console.WriteLine("Determinant:       {0}", cdl.GetDeterminant().ToString("E3"));
                   Console.WriteLine();
            
                   // get the inverse
                   ComplexFloatMatrix I = cdl.GetInverse();
                   Console.WriteLine("Inverse:: {0} ", I.ToString("E3"));
                   Console.WriteLine();
            
                   // solve a linear system
                   ComplexFloatVector Y = new ComplexFloatVector(3);
                   Y[0] = new ComplexFloat(1.0f, 1.0f);
                   Y[1] = new ComplexFloat(2.0f, 2.0f);
                   Y[2] = new ComplexFloat(3.0f, 3.0f);
            
                   ComplexFloatVector X = cdl.Solve(Y);
                   Console.WriteLine("X:: {0} ", X.ToString("E3"));
                   Console.WriteLine();
                 }
               }
            
             }

The application generates the following results:

             Matrix:: rows: 3, cols: 3
              3.000E+000 + 3.000E+000i, 2.000E+000 + 1.000E+000i, 1.000E+000 + 0.000E+000i
              2.000E+000 + 0.000E+000i, 3.000E+000 + 3.000E+000i, 2.000E+000 + 1.000E+000i
              1.000E+000 + 1.000E+000i, 2.000E+000 + 0.000E+000i, 3.000E+000 + 3.000E+000i
            
             Singular:          False
             Determinant:       -6.300E+001 + 1.900E+001i
            
             Inverse:: rows: 3, cols: 3
              1.284E-001 - 2.152E-001i, -2.494E-002 + 1.353E-001i,  4.388E-003 - 1.455E-002i
              5.958E-002 + 6.559E-002i,  8.915E-002 - 2.430E-001i, -2.494E-002 + 1.353E-001i
             -8.453E-002 + 6.975E-002i,  5.958E-002 + 6.559E-002i,  1.284E-001 - 2.152E-001i
            
             X:: Length: 3
              7.991E-002 + 1.035E-001i, 1.774E-001 + 1.487E-001i, 8.647E-001 - 2.494E-002i

Constructors

Constructor Description

ComplexFloatLevinson(col, row)

Full Usage: ComplexFloatLevinson(col, row)

Parameters:

Constructor with ComplexFloatVector parameters.

col : IROComplexFloatVector

The left-most column of the Toeplitz matrix.

row : IROComplexFloatVector

The top-most row of the Toeplitz matrix.

ArgumentNullException col is a null reference,

or

row is a null reference.

RankException The length col col is zero,

or

the length of col does not match that of row.

ArithmeticException The values of the first element of col and row are not equal.

Instance members

Instance member Description

this.D

Full Usage: this.D

Returns: ComplexFloatMatrix

Get the diagonal matrix of the UDL factorisation.

It is recommended that the ComplexFloatLevinson.IsSingular property be checked to see if the decomposition was completed, before attempting to obtain the diagonal matrix.

Returns: ComplexFloatMatrix
SingularMatrixException The Toeplitz matrix or one of the the leading sub-matrices is singular.

this.GetDeterminant

Full Usage: this.GetDeterminant

Returns: ComplexFloat The value of the determinant.

Get the determinant of the Toeplitz matrix.

It is recommended that the ComplexFloatLevinson.IsSingular property be checked to see if the decomposition was completed, before attempting to obtain the determinant.

Returns: ComplexFloat

The value of the determinant.

SingularMatrixException The Toeplitz matrix or one of the the leading sub-matrices is singular.

this.GetInverse

Full Usage: this.GetInverse

Returns: ComplexFloatMatrix The inverse matrix.

Get the inverse of the Toeplitz matrix.

The class implicitly decomposes the inverse Toeplitz matrix into a UDL factorisation using the Levinson algorithm, before using an extended version of Trench's algorithm to complete the inversion.

The extended version of Trench's algorithm requires approximately N squared FLOPS, compared to N cubed FLOPS if we simply multiplied the UDL factors (N is the matrix order).

Returns: ComplexFloatMatrix

The inverse matrix.

SingularMatrixException The Toeplitz matrix or one of the the leading sub-matrices is singular.

this.GetLeftColumn

Full Usage: this.GetLeftColumn

Returns: ComplexFloatVector The left-column vector.

Get a vector that represents the left-most column of the Toplitz matrix.

Returns: ComplexFloatVector

The left-column vector.

this.GetMatrix

Full Usage: this.GetMatrix

Returns: ComplexFloatMatrix The Toeplitz matrix

Get a copy of the Toeplitz matrix.

Returns: ComplexFloatMatrix

The Toeplitz matrix

this.GetTopRow

Full Usage: this.GetTopRow

Returns: ComplexFloatVector The top row vector.

Get a vector that represents the top-most row of the Toplitz matrix.

Returns: ComplexFloatVector

The top row vector.

this.IsSingular

Full Usage: this.IsSingular

Returns: bool

Check if the Toeplitz matrix or any leading sub-matrices are singular.

If the Toeplitz matrix or any leading sub-matrices are singular, it is not possible to complete the UDL decomposition using the Levinson algorithm.

Returns: bool

this.L

Full Usage: this.L

Returns: ComplexFloatMatrix

Get the lower triangle matrix of the UDL factorisation.

It is recommended that the ComplexFloatLevinson.IsSingular property be checked to see if the decomposition was completed, before attempting to obtain the lower triangle matrix.

Returns: ComplexFloatMatrix
SingularMatrixException The Toeplitz matrix or one of the the leading sub-matrices is singular.

this.Order

Full Usage: this.Order

Returns: int

Get the order of the Toeplitz matrix.

Returns: int

this.Solve

Full Usage: this.Solve

Parameters:
Returns: ComplexFloatVector The solution vector.

Solve a square Toeplitz system with a right-side vector.

This member solves the linear system TX = Y, where T is the square Toeplitz matrix, X is the unknown solution vector and Y is a known vector.

The class implicitly decomposes the inverse Toeplitz matrix into a UDL factorisation using the Levinson algorithm, before calculating the solution vector.

Y : IROComplexFloatVector

The right-hand side of the system.

Returns: ComplexFloatVector

The solution vector.

ArgumentNullException Parameter Y is a null reference.
RankException The length of Y is not equal to the number of rows in the Toeplitz matrix.
SingularMatrixException The Toeplitz matrix or one of the the leading sub-matrices is singular.

this.Solve

Full Usage: this.Solve

Parameters:
Returns: ComplexFloatMatrix The solution matrix.

Solve a square Toeplitz system with a right-side matrix.

This member solves the linear system TX = Y, where T is a square Toeplitz matrix, X is the unknown solution matrix and Y is a known matrix.

The class implicitly decomposes the inverse Toeplitz matrix into a UDL factorisation using the Levinson algorithm, before calculating the solution vector.

Y : IROComplexFloatMatrix

The right-side matrix

Returns: ComplexFloatMatrix

The solution matrix.

ArgumentNullException Parameter Y is a null reference.
RankException The number of rows in Y is not equal to the number of rows in the Toeplitz matrix.
SingularMatrixException The Toeplitz matrix or one of the the leading sub-matrices is singular.

this.U

Full Usage: this.U

Returns: ComplexFloatMatrix

Get the upper triangle matrix of the UDL factorisation.

It is recommended that the ComplexFloatLevinson.IsSingular property be checked to see if the decomposition was completed, before attempting to obtain the upper triangle matrix.

Returns: ComplexFloatMatrix
SingularMatrixException The Toeplitz matrix or one of the the leading sub-matrices is singular.

Static members

Static member Description

ComplexFloatLevinson.Inverse(col, row)

Full Usage: ComplexFloatLevinson.Inverse(col, row)

Parameters:
Returns: ComplexFloatMatrix The inverse matrix.

Invert a square Toeplitz matrix.

This static member combines the UDL decomposition and Trench's algorithm into a single algorithm. It requires minimal data storage, compared to the non-static member and suffers from no speed penalty in comparision.

Trench's algorithm requires N squared FLOPS, compared to N cubed FLOPS if we simply solved a linear Toeplitz system with a right-side identity matrix (N is the matrix order).

col : IROComplexFloatVector

The left-most column of the Toeplitz matrix.

row : IROComplexFloatVector

The top-most row of the Toeplitz matrix.

Returns: ComplexFloatMatrix

The inverse matrix.

ArgumentNullException col is a null reference.

or

row is a null reference.

RankException The length of col is 0,

or

the lengths of col and row are not equal.

SingularMatrixException The Toeplitz matrix or one of the the leading sub-matrices is singular.
ArithmeticException The values of the first element of col and row are not equal.

ComplexFloatLevinson.Solve(col, row, Y)

Full Usage: ComplexFloatLevinson.Solve(col, row, Y)

Parameters:
Returns: ComplexFloatVector The solution vector.

Solve a square Toeplitz system with a right-side vector.

This method solves the linear system AX = Y. Where T is a square Toeplitz matrix, X is an unknown vector and Y is a known vector.

The classic Levinson algorithm is used to solve the system. The algorithm assumes that all the leading sub-matrices of the Toeplitz matrix are non-singular. When a sub-matrix is near singular, accuracy will be degraded. This member requires approximately N squared FLOPS to calculate a solution, where N is the matrix order.

This static method has minimal storage requirements as it combines the UDL decomposition with the calculation of the solution vector in a single algorithm.

col : IROComplexFloatVector

The left-most column of the Toeplitz matrix.

row : IROComplexFloatVector

The top-most row of the Toeplitz matrix.

Y : IROComplexFloatVector

The right-side vector of the system.

Returns: ComplexFloatVector

The solution vector.

ArgumentNullException col is a null reference,

or

row is a null reference,

or

Y is a null reference.

RankException The length of col is 0,

or

the lengths of col and row are not equal,

or

the number of rows in Y does not the length of col and row.

SingularMatrixException The Toeplitz matrix or one of the the leading sub-matrices is singular.
ArithmeticException The values of the first element of col and row are not equal.

ComplexFloatLevinson.Solve(col, row, Y)

Full Usage: ComplexFloatLevinson.Solve(col, row, Y)

Parameters:
Returns: ComplexFloatMatrix The solution matrix.

Solve a square Toeplitz system with a right-side matrix.

This method solves the linear system AX = Y. Where T is a square Toeplitz matrix, X is an unknown matrix and Y is a known matrix.

The classic Levinson algorithm is used to solve the system. The algorithm assumes that all the leading sub-matrices of the Toeplitz matrix are non-singular. When a sub-matrix is near singular, accuracy will be degraded. This member requires approximately N squared FLOPS to calculate a solution, where N is the matrix order.

This static method has minimal storage requirements as it combines the UDL decomposition with the calculation of the solution vector in a single algorithm.

col : IROComplexFloatVector

The left-most column of the Toeplitz matrix.

row : IROComplexFloatVector

The top-most row of the Toeplitz matrix.

Y : IROComplexFloatMatrix

The right-side matrix of the system.

Returns: ComplexFloatMatrix

The solution matrix.

ArgumentNullException col is a null reference,

or

row is a null reference,

or

Y is a null reference.

RankException The length of col is 0,

or

the lengths of col and row are not equal,

or

the number of rows in Y does not the length of col and row.

SingularMatrixException The Toeplitz matrix or one of the the leading sub-matrices is singular.
ArithmeticException The values of the first element of col and row are not equal.