Class BWMatrix
The Burrows-Wheeler Matrix (BWM) of a TextWithTerminator is the square matrix all cyclic rotations of the provided TextWithTerminator, with rows sorted in ascending order and taking into account that Terminator is to be considered smaller than any other char in the text.
Inheritance
Implements
Inherited Members
Namespace: MoreStructures.BurrowsWheelerTransform
Assembly: MoreStructures.dll
Syntax
public class BWMatrix : IEquatable<BWMatrix>
Remarks
This langword_csharp_record is a typed wrapped of the underlying langword_csharp_IList{string} representing the BWM. It guarantes immutability and strong typing, and also keeps together the Text and its matrix Content, providing BWM-specific functionalities.
Constructors
| Improve this Doc View SourceBWMatrix(TextWithTerminator, IList<String>)
The Burrows-Wheeler Matrix (BWM) of a TextWithTerminator is the square matrix all cyclic rotations of the provided TextWithTerminator, with rows sorted in ascending order and taking into account that Terminator is to be considered smaller than any other char in the text.
Declaration
public BWMatrix(TextWithTerminator Text, IList<string> Content)
Parameters
Type | Name | Description |
---|---|---|
TextWithTerminator | Text | The text, corresponding to the provided BWM. |
IList<System.String> | Content | The content of the Burrows-Wheeler Matrix (BWM) of Text. |
Remarks
This langword_csharp_record is a typed wrapped of the underlying langword_csharp_IList{string} representing the BWM. It guarantes immutability and strong typing, and also keeps together the Text and its matrix Content, providing BWM-specific functionalities.
Properties
| Improve this Doc View SourceContent
Declaration
public IList<string> Content { get; set; }
Property Value
Type | Description |
---|---|
IList<System.String> | A readonly immutable list of strings, each one containing a row of the matrix, i.e. a string containing a cyclic rotation of Text. |
Examples
Code:
new BWTMatrix(new("ab"), new string[] { "$ab", "ab$", "b$a" }).Content
Result:
{
"$ab",
"ab$",
"b$a",
}
|
Improve this Doc
View Source
FirstColumn
Returns the first column of this BWMatrix. Corresponds to the sorted Text and also to the sorted Transform of this BWMatrix.
Declaration
public string FirstColumn { get; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
Unlike LastColumn and Transform, FirstColumn wouldn't require computation of the Content of this BWMatrix, since the FirstColumn can easily be calculated by sorting the input Text.
Examples
Code:
new BWTMatrix(new("mississippi")).FirstColumn
Result:
"$iiiimppssss"
|
Improve this Doc
View Source
LastColumn
Returns the last column of this BWMatrix. Corresponds to the Content of the Transform of this BWMatrix.
Declaration
public string LastColumn { get; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
Requires Content calculation.
Examples
Code:
new BWTMatrix(new("mississippi")).LastColumn
Result:
"ipssm$pissii"
|
Improve this Doc
View Source
Text
Declaration
public TextWithTerminator Text { get; set; }
Property Value
Type | Description |
---|---|
TextWithTerminator |
Transform
Builds the Burrows-Wheeler Transform from this BWMatrix, which corresponds to the last column of the matrix, stored in Content.
Declaration
public BWTransform Transform { get; }
Property Value
Type | Description |
---|---|
BWTransform | A BWTransform object wrapping the string containing the Burrows-Wheeler transform. |
Remarks
Requires Content calculation.
Examples
Code:
new BWTMatrix(new("mississippi")).Transform;
Result:
"ipssm$pissii"