C# Class EncryptionAlgorithms.MatrixClass

Classes Contained: MatrixClass (version 1.1) MatrixClassException Fraction (Version 2.0) FractionException
Exibir arquivo Open project: Omar-Salem/Classical-Encryption-Techniques Class Usage Examples

Public Methods

Method Description
AddRow ( int iTargetRow, int iSecondRow, Fraction iMultiple ) : void

The function adds two rows for current MatrixClass object It performs the following calculation: iTargetRow = iTargetRow + iMultiple*iSecondRow

Adjoint ( int b ) : MatrixClass

The function returns the adjoint of the current MatrixClass

Concatenate ( MatrixClass MatrixClass1, MatrixClass MatrixClass2 ) : MatrixClass

The function concatenates the two given matrices column-wise it can be helpful in a equation solver class where the augmented MatrixClass is obtained by concatenation

Determinent ( ) : Fraction

The function returns the determinent of the current MatrixClass object as Fraction It computes the determinent in the traditional way (i.e. using minors) It can be much slower(due to recursion) if the given MatrixClass has order greater than 6 Try using DeterminentFast() function if the order of MatrixClass is greater than 6

DeterminentFast ( ) : Fraction

The function returns the determinent of the current MatrixClass object as Fraction It computes the determinent by reducing the MatrixClass to reduced echelon form using row operations The function is very fast and efficient but may raise overflow exceptions in some cases. In such cases use the Determinent() function which computes determinent in the traditional manner(by using minors)

Duplicate ( ) : MatrixClass

The function duplicates the current MatrixClass object

EchelonForm ( ) : MatrixClass

The function returns the Echelon form of the current MatrixClass

IdentityMatrixClass ( int iRows, int iCols ) : MatrixClass

The function returns an identity MatrixClass of dimensions ( Row x Col )

InterchangeRow ( int iRow1, int iRow2 ) : void

The function interchanges two rows of the current MatrixClass object

Inverse ( ) : MatrixClass

The function returns the inverse of the current MatrixClass in the traditional way(by adjoint method) It can be much slower if the given MatrixClass has order greater than 6 Try using InverseFast() function if the order of MatrixClass is greater than 6

InverseFast ( ) : MatrixClass

The function returns the inverse of the current MatrixClass using Reduced Echelon Form method The function is very fast and efficient but may raise overflow exceptions in some cases. In such cases use the Inverse() method which computes inverse in the traditional way(using adjoint).

MatrixClass ( Fraction elements ) : System

Constructors

MatrixClass ( double elements ) : System
MatrixClass ( int elements ) : System
MatrixClass ( int iRows, int iCols ) : System
Minor ( MatrixClass MatrixClass, int iRow, int iCol ) : MatrixClass

The function return the Minor of element[Row,Col] of a MatrixClass object

MultiplyRow ( int iRow, Fraction frac ) : void

The function multiplies the given row of the current MatrixClass object by a Fraction

MultiplyRow ( int iRow, double dbl ) : void

The function multiplies the given row of the current MatrixClass object by a double

MultiplyRow ( int iRow, int iNo ) : void

The function multiplies the given row of the current MatrixClass object by an integer

NullMatrixClass ( int iRows, int iCols ) : MatrixClass

The function returns a Null MatrixClass of dimension ( Row x Col )

ReducedEchelonForm ( ) : MatrixClass

The function returns the reduced echelon form of the current MatrixClass

ScalarMatrixClass ( int iRows, int iCols, int K ) : MatrixClass

The function returns a Scalar MatrixClass of dimension ( Row x Col ) and scalar K

ToString ( ) : string

The function returns the current MatrixClass object as a string

Transpose ( ) : MatrixClass

The function returns the transpose of the current MatrixClass

UnitMatrixClass ( int iRows, int iCols ) : MatrixClass

The function returns a Unit MatrixClass of dimension ( Row x Col )

operator ( ) : MatrixClass
this ( int iRow, int iCol ) : Fraction

Indexer

Private Methods

Method Description
Add ( MatrixClass MatrixClass1, MatrixClass MatrixClass2 ) : MatrixClass
Determinent ( MatrixClass MatrixClass ) : Fraction

The helper function for the above Determinent() method it calls itself recursively and computes determinent using minors

FindB ( int Det ) : int
GetElement ( int iRow, int iCol ) : Fraction

Internal functions for getting/setting values

Multiply ( MatrixClass MatrixClass, Fraction frac ) : MatrixClass
Multiply ( MatrixClass MatrixClass1, MatrixClass MatrixClass2 ) : MatrixClass
Multiply ( MatrixClass MatrixClass, int iNo ) : MatrixClass
Negate ( MatrixClass MatrixClass ) : MatrixClass

Internal Fucntions for the above operators

SetElement ( int iRow, int iCol, Fraction value ) : void

Method Details

AddRow() public method

The function adds two rows for current MatrixClass object It performs the following calculation: iTargetRow = iTargetRow + iMultiple*iSecondRow
public AddRow ( int iTargetRow, int iSecondRow, Fraction iMultiple ) : void
iTargetRow int
iSecondRow int
iMultiple Fraction
return void

Adjoint() public method

The function returns the adjoint of the current MatrixClass
public Adjoint ( int b ) : MatrixClass
b int
return MatrixClass

Concatenate() public static method

The function concatenates the two given matrices column-wise it can be helpful in a equation solver class where the augmented MatrixClass is obtained by concatenation
public static Concatenate ( MatrixClass MatrixClass1, MatrixClass MatrixClass2 ) : MatrixClass
MatrixClass1 MatrixClass
MatrixClass2 MatrixClass
return MatrixClass

Determinent() public method

The function returns the determinent of the current MatrixClass object as Fraction It computes the determinent in the traditional way (i.e. using minors) It can be much slower(due to recursion) if the given MatrixClass has order greater than 6 Try using DeterminentFast() function if the order of MatrixClass is greater than 6
public Determinent ( ) : Fraction
return Fraction

DeterminentFast() public method

The function returns the determinent of the current MatrixClass object as Fraction It computes the determinent by reducing the MatrixClass to reduced echelon form using row operations The function is very fast and efficient but may raise overflow exceptions in some cases. In such cases use the Determinent() function which computes determinent in the traditional manner(by using minors)
public DeterminentFast ( ) : Fraction
return Fraction

Duplicate() public method

The function duplicates the current MatrixClass object
public Duplicate ( ) : MatrixClass
return MatrixClass

EchelonForm() public method

The function returns the Echelon form of the current MatrixClass
public EchelonForm ( ) : MatrixClass
return MatrixClass

IdentityMatrixClass() public static method

The function returns an identity MatrixClass of dimensions ( Row x Col )
public static IdentityMatrixClass ( int iRows, int iCols ) : MatrixClass
iRows int
iCols int
return MatrixClass

InterchangeRow() public method

The function interchanges two rows of the current MatrixClass object
public InterchangeRow ( int iRow1, int iRow2 ) : void
iRow1 int
iRow2 int
return void

Inverse() public method

The function returns the inverse of the current MatrixClass in the traditional way(by adjoint method) It can be much slower if the given MatrixClass has order greater than 6 Try using InverseFast() function if the order of MatrixClass is greater than 6
public Inverse ( ) : MatrixClass
return MatrixClass

InverseFast() public method

The function returns the inverse of the current MatrixClass using Reduced Echelon Form method The function is very fast and efficient but may raise overflow exceptions in some cases. In such cases use the Inverse() method which computes inverse in the traditional way(using adjoint).
public InverseFast ( ) : MatrixClass
return MatrixClass

MatrixClass() public method

Constructors
public MatrixClass ( Fraction elements ) : System
elements Fraction
return System

MatrixClass() public method

public MatrixClass ( double elements ) : System
elements double
return System

MatrixClass() public method

public MatrixClass ( int elements ) : System
elements int
return System

MatrixClass() public method

public MatrixClass ( int iRows, int iCols ) : System
iRows int
iCols int
return System

Minor() public static method

The function return the Minor of element[Row,Col] of a MatrixClass object
public static Minor ( MatrixClass MatrixClass, int iRow, int iCol ) : MatrixClass
MatrixClass MatrixClass
iRow int
iCol int
return MatrixClass

MultiplyRow() public method

The function multiplies the given row of the current MatrixClass object by a Fraction
public MultiplyRow ( int iRow, Fraction frac ) : void
iRow int
frac Fraction
return void

MultiplyRow() public method

The function multiplies the given row of the current MatrixClass object by a double
public MultiplyRow ( int iRow, double dbl ) : void
iRow int
dbl double
return void

MultiplyRow() public method

The function multiplies the given row of the current MatrixClass object by an integer
public MultiplyRow ( int iRow, int iNo ) : void
iRow int
iNo int
return void

NullMatrixClass() public static method

The function returns a Null MatrixClass of dimension ( Row x Col )
public static NullMatrixClass ( int iRows, int iCols ) : MatrixClass
iRows int
iCols int
return MatrixClass

ReducedEchelonForm() public method

The function returns the reduced echelon form of the current MatrixClass
public ReducedEchelonForm ( ) : MatrixClass
return MatrixClass

ScalarMatrixClass() public static method

The function returns a Scalar MatrixClass of dimension ( Row x Col ) and scalar K
public static ScalarMatrixClass ( int iRows, int iCols, int K ) : MatrixClass
iRows int
iCols int
K int
return MatrixClass

ToString() public method

The function returns the current MatrixClass object as a string
public ToString ( ) : string
return string

Transpose() public method

The function returns the transpose of the current MatrixClass
public Transpose ( ) : MatrixClass
return MatrixClass

UnitMatrixClass() public static method

The function returns a Unit MatrixClass of dimension ( Row x Col )
public static UnitMatrixClass ( int iRows, int iCols ) : MatrixClass
iRows int
iCols int
return MatrixClass

operator() public static method

public static operator ( ) : MatrixClass
return MatrixClass

this() public method

Indexer
public this ( int iRow, int iCol ) : Fraction
iRow int
iCol int
return Fraction