HoriAsso - Public Class LieTreeVector

From Drorbn
Jump to navigationJump to search


Fields

The main information is 3 arrays all filled up to the same length . At each index, the three array elements represent the coefficient, the Lie-tree structure, and the index at which that Lie-tree structure, if a Lyndon Basis element, appears in the set of ordered Lyndon basis elements with the same size as the lie-tree. It also contains the set of Lyndon basis with n generators up to length 15 for now (doe to the limit of the size of the class Arrays using integers as the index).

All of the fields are private and to be accessed through the access functions.



private int numTerms: number of Terms of the linear combination of lie-treesprivate int coeffArray[]: an array of coefficients. The type will be changed to class BigRational private Tree[] treeArray: an array of lie-tree structure private int[] basisIndexArray: an array of the each tree's index in the corresponding Lyndon basis private LyndonBasis lyndonBasis: an array of arrays of Lyndon basis (i.e. Lyndon Words) at different word length.


The actual lengths of the arrays are set to in nteger maxNumTerms, which is the biggest integer at the moment. However, for all purposes, numTerms (above) should be used as the length of the linear combination of lie-trees.

There are private boolean flag arrays to see what form the linear combination is if truncated at each term:

   	private boolean[] isSimplified: if truncated at the array index, does the linear combination of lie-trees have repeated tree structures, i.e., not simplified
   	private boolean[] isLyndonForm;  if truncated at the array index, does the linear combination of lie-trees contain all Lyndon Trees only
   	private boolean[] isBasisIndexFilled;  if truncated at the array index, if the lie-tree in every term is in the basis, has its index been identified and stored in the basisIndexArray

Constructor List

Constructor Details

===public LieTreeVector(): minimal constructor that allocates memory for all arrays, set numTerms to 0, but does not specify which Free Lie Algebra (ie with how many generators) the instance belong to. The empty trees have their 3 flags: isLyndon, isBasisIndexFilled and isSimplified all set to true


===public LieTreeVector(LyndonBasis whichLyndonBasis) throws LyndonBasisEmptyException: minimal constructor that

allocates memory for all arrays, 

set numTerms to 0, and also set the lyndonBasis to an input LyndonBasis by reference. The empty trees have their 3 flags: isLyndon, isBasisIndexFilled and isSimplified all set to true


Instances of LieTreeVector created using this belongs to the Free Lie Algebra (with the specific number of generators) specified by the lyndonBasis.

Usage: The LyndonBasis would have to be fully created in the application before being passed in, otherwise, the LyndonBasisEmptyException would be thrown


===public LieTreeVector(int howManyGenerators,int maxWordLength): minimal constructor that

allocates memory for all arrays, 

set numTerms to 0, and also construct the lyndonBasis according to the inputs from scratch.

Instances of LieTreeVector created using this belongs to the Free Lie Algebra (with the specific number of generators) specified by the input howManyGenerators.

Usage: 1.caution: Use at most 3 generators at maxWordLength needs to be <= 16 for now. 2. since all the elements belong to the same Free Lie Algebra use the same LyndonBasis, constructor the LyndonBasis in advance and using the other constructor "public LieTreeVector(LyndonBasis whichLyndonBasis)" is more resource-economical.

===public LieTreeVector(int singleCoeff, LieTree singleTree) creates an instance that contains the first term in the linear combination but does not record which free Lie Algebra this instance belongs to, i.e., which LyndonBasis to use


Usage: it is ok to pass in an empty the LieTree, nothing would be done then except the most minimal constructor (LieTreeVector()) would be called.


===public LieTreeVector(LyndonBasis, whichLyndonBasis, int singleCoeff, LieTree singleTree) creates an instance that contains the first term in the linear combination and also also set the lyndonBasis to an input LyndonBasis by reference.

Usage: 1 Using an empty Tree as the argument would not result in an error

2. The LyndonBasis would have to be fully created in the application before being passed in, otherwise, the LyndonBasisEmptyException would be thrown


public LieTreeVector(int howManyGenerators,int maxWordLength, int singleCoeff, LieTree singleTree){ creates an instance that contains the first term in the linear combination and also construct the lyndonBasis according to the inputs from scratch.

Usage: 1caution: Use at most 3 generators at maxWordLength needs to be <= 16 for now.

2. since all the elements belong to the same Free Lie Algebra use the same LyndonBasis, constructor the LyndonBasis in advance and using the other constructor "public LieTreeVector(LyndonBasis whichLyndonBasis)" is more resource-economical.


===public LieTreeVector(int coeff1, LieTree tree1, int coeff2, LieTree tree2) creates an instance that contains the first two terms in the linear combination but does not record which free Lie Algebra this instance belongs to, i.e., which LyndonBasis to use


Usage: it is ok to pass in an empty the LieTree, nothing would be done then except the most minimal constructor (LieTreeVector()) would be called.



===public LieTreeVector(LyndonBasis, whichLyndonBasis, int coeff1, LieTree tree1, int coeff2, LieTree tree2) creates an instance that contains the first two terms in the linear combination and also also set the lyndonBasis to an input LyndonBasis by reference.

Usage: 1 Using empty trees in the argument would not result in an error, but

2. The LyndonBasis would have to be fully created in the application before being passed in, otherwise, the LyndonBasisEmptyException would be thrown



===public LieTreeVector(int howManyGenerators,int maxWordLength, int coeff1, LieTree tree1, int coeff2, LieTree tree2){ creates an instance that contains the first two terms in the linear combination and also construct the lyndonBasis according to the inputs from scratch.

Usage: caution: Use at most 3 generators at maxWordLength needs to be <= 16 for now. 2. since all the elements belong to the same Free Lie Algebra use the same LyndonBasis, constructor the LyndonBasis in advance and using the other constructor "public LieTreeVector(LyndonBasis whichLyndonBasis)" is more resource-economical.


===public LieTreeVector(int[] inputCoeffArray,LieTree



Method Summary

=== public TreeVector simplifychangeOriginal() return a



==APPEND METHODS === private void addEmptyTree() allocate memory for one more term in the linear combination. Used by other methods


=== public void append(int coeffOfAddedTree, LieTree addedTree, int basisIndexOfAddedTree)

=== public void append(int coeffOfAddedTree, LieTree addedTree)


=== public void append(LieTree addedTree)


=== public void append(LieTreeVector addedTreeVector)


=== public void appendByReference(int coeffOfAddedTree, LieTree leftSubtree, LieTree rightSubtree)

=== public void appendByReference(int coeffOfAddedTree, LieTree addedTree, int basisIndexOfAddedTree)

=== public void appendByReference(int coeffOfAddedTree, LieTree addedTree)


=== public void appendByReference(LieTree addedTree)


=== public void appendByReference(LieTreeVector addedTreeVector)


==INSERT METHODS

===public void insertByReference(int index, int coeffToInsert,LieTree treeToInsert,int basisIndexToInsert)


===public void insert(int index, int coeffToInsert,LieTree treeToInsert,int basisIndexToInsert)


==REPLACE METHODS === public void replaceCoeff(int index, int toCoeff){ ERROR: if ((index<0) || index>=numTerms)) throw IndexOutOfBoundException

=

   public void replace(int index, LieTree toTree){
   public void replaceByReference(int index, LieTree toTree){

//ERROR: if ((index<0) || (index>=numTerms)) throw IndexOutOfBoundException



=== public void replace(int index, int toCoeff, LieTree toTree){

   public void replaceByReference (int index, int toCoeff, LieTree toTree){
   	//ERROR:  if ((index<0) || index>=numTerms)) throw IndexOutOfBoundException



=== public void replace (int index, int toCoeff, LieTree toTree,int toBasisIndex){

public void replaceByReference (int index, int toCoeff, LieTree toTree,int toBasisIndex){
   	//ERROR:  if ((index<0) || index>=numTerms)) throw IndexOutOfBoundException


===public void replace (int index, LieTreeVector toLieTreeVector){
 
    public void replaceByReference (int index, LieTreeVector toLieTreeVector){

//ERROR: if ((index<0) || index+toLieTreeVector>=numTerms)) throw IndexOutOfBoundException //ERROR: if (!lyndonBasis.equalTo(toLieTreeVector.lyndonBasis) throw ElementsOfDifferentAlbebraException

==COPY METHODs


==COPY METHODS public LieTreeVector copySubLieTreeVector(int startIndex, int endIndex) public LieTreeVector copySubLieTreeVector(int startIndex) public LieTreeVector makeCopy() public LieTreeVector copySubLieTreeVectorByReference(int startIndex, int endIndex) public LieTreeVector copySubLieTreeVectorByReference(int startIndex)



Method Details

===ACCESS Methods


==EDIT METHODS return Void

The sets of APPEND, REPLACE, INSERT methods can be used to change the caller LieTreeVector by appending, replacing, or inserting the arguments-- either LieTrees (with its coefficient and maybe also its basisIndex) or LieTreeVectors.

There is a choice or appending, replacing, or inserting the arguments by reference, and those methods have names with Suffix "ByReference". This is used in other methods to optimize efficiency.

They all have void as return values.


===APPEND METHODS

The append methods add term(s) to a LieTreeVector at the end literally, ie., (an empty tree can be added and will increase the number of terms for the treevector) without doing simplifying or reducing into the Lyndon basis. They also update the flags isLyndonForm, isSimplified, isBasisIndexArrayFilled


=== private void addEmptyTree() allocate memory for one more term in the linear combination. Used by other methods only

The flags do not get changed


=== public void append(int coeffOfAddedTree, LieTree addedTree, int basisIndexOfAddedTree) Error: if the addedTree is not a lyndon tree, AddedTreeNotLyndonException will be throw Error: if the basisIndexOfAddedTree is outside the index range of the set of Lyndon Basis of the same length, then the basisIndexOutOfBoundException will be thrown. Error: ((LyndonBasis==null)||(lyndonBasis.isEmpty())) throw NoValidLynondBasisException

append an extra term with a coefficient, a Lyndon tree, and its basis index specified in the argument. The flags--isLyndonForm, isBasisIndexFilled-- are updated accordingly, but isSImplified is always changed to false. Usage: Use this method when the original caller also has its basisIndexArray filled; otherwise, the flag isBasisIndexArrayFilled remains false and the newly added basisIndex would not be looked at anyways.


CAUTION: The user should make sure the added Lyndon Tree and the basis index match. This method is provided for efficiency and so does not check if the index is correct for the added tree.

=== public void append(int coeffOfAddedTree, LieTree addedTree)

append an extra term with a coefficient and a tree (does not have to be a Lyndon tree) specified in the argument. The isSimplified and isBasisIndexfilled flags are changed to false.


=== public void append(LieTree addedTree)

append an extra term with the coefficient 1 and a tree (does not have to be a Lyndon tree) specified in the argument. The flags--isLyndonForm, isSimplified, isBasisIndexFilled-- are updated accordingly.

=== public void append (LieTreeVector addedTreeVector) Error: if the basis indices in addedTreeVector are outside the index range of the set of Lyndon Basis of the same length, then the basisIndexOutOfBoundException will be thrown. append the specified LieTreeVector. If the addedTreedVector has its basisIndexArray filled, then it is also going to be filled (even if the caller's is not), otherwise it won't be.

=== public void appendByReference(int coeffOfAddedTree, LieTree leftSubtree, LieTree rightSubtree) append an extra term with a coefficient and a tree with left and right subtrees specified in the argument. The flags--isLyndonForm, isSimplified, isBasisIndexFilled-- are updated accordingly. CAUTION: the left and right subtrees are only recorded by reference, therefore use " public void append(int coeffOfAddedTree, LieTree leftSubtree, LieTree rightSubtree)" instead if the trees in the argument could be altered after this method is called.


=== public void appendByReference(int coeffOfAddedTree, LieTree addedTree, int basisIndexOfAddedTree) Error: if the addedTree is not a lyndon tree, AddedTreeNotLyndonException will be throw Error: if the basisIndexOfAddedTree is outside the index range of the set of Lyndon Basis of the same length, then the basisIndexOutOfBoundException will be thrown. Error: ((LyndonBasis==null)||(lyndonBasis.isEmpty())) throw NoValidLynondBasisException


append an extra term with a coefficient, a Lyndon tree, and its basis index specified in the argument. The flags--isLyndonForm, isBasisIndexFilled-- are updated accordingly, but isSImplified is always changed to false. Usage: Use this method when the original caller also has its basisIndexArray filled; otherwise, the flag isBasisIndexArrayFilled remains false and the newly added basisIndex would not be looked at anyways.


CAUTION: The user should make sure the added Lyndon Tree and the basis index match. This method is provided for efficiency and so does not check if the index is correct for the added tree.

CAUTION: the added tree is only recorded by reference, therefore use " public void append with the same arguments instead if the tree in the argument has a chance to be altered after this method is called.


=== public void appendByReference(int coeffOfAddedTree, LieTree addedTree)

append an extra term with a coefficient and a tree (does not have to be a Lyndon tree) specified in the argument. The isSimplified and isBasisIndexfilled flags are changed to false.

CAUTION: the added tree is only recorded by reference, therefore use " public void append" with the same arguments if the trees in the argumment has a chance to be altered after this method is called.


=== public void appendByReference(LieTree addedTree)

append an extra term with the coefficient 1 and a tree (does not have to be a Lyndon tree) specified in the argument. The flags--isLyndonForm, isSimplified, isBasisIndexFilled-- are updated accordingly. CAUTION: the added tree is only recorded by reference, therefore use " public void append" with the same arguments if the trees in the argumment has a chance to be altered after this method is called.

=== public void appendByReference (LieTreeVector addedTreeVector) Error: if the basis indices in addedTreeVector are outside the index range of the set of Lyndon Basis of the same length, then the basisIndexOutOfBoundException will be thrown. append the specified LieTreeVector with the flags--isLyndonForm, isSimplified, isBasisIndexFilled-- updated accordingly. If the addedTreedVector has its basisIndexArray filled, then it is also going to be filled (even if the caller's is not), otherwise it won't be.

CAUTION: the trees in the added terms are only recorded by reference, therefore use " public void append" with the same arguments if the addedTreeVector in the argumment has a chance to be altered after this method is called.




==INSERT METHODS

The insert methods insert a term at a specific index of the LieTreeVector and shift every term after that by one index. Their arguments can be zero (either an empty TRee or a zero coefficient), and they will simply do nothing

===public void insertByReference(int index, int coeffToInsert,LieTree treeToInsert,int basisIndexToInsert) insert a LieTree by reference, along with its coeffient, and its basisindex at the input index.

Usage:The caller LieTreeVector can be empty, but then the index would have to be 0. If The argument is zero (i.e., the coefficient is zero or the LieTree is empty), nothing will be done.

Error: if the index is out of bound, i.e., <0 or >= number of Terms of the caller, the IndexOutOfBoundException will be thrown Error: in the case the caller is empty, if index has to be only 0, otherwise,the IndexOutOfBoundException will be thrown


Caution: the argument tree is inserted by reference, use the method "insert" with the same arguments if there is a chance the LieTree to insert will be changed after this method is called.


===public void insert(int index, int coeffToInsert,LieTree treeToInsert,int basisIndexToInsert){

insert a LieTree, along with its coeffient, and its basisindex at the input index.

Usage:The caller LieTreeVector can be empty, but then the index would have to be 0. If The argument is zero (i.e., the coefficient is zero or the LieTree is empty), nothing will be done.

Error: if the index is out of bound, i.e., <0 or >= number of Terms of the caller, the IndexOutOfBoundException will be thrown Error: in the case the caller is empty, if index has to be only 0, otherwise,the IndexOutOfBoundException will be thrown


==REPLACE METHODS === public void replaceCoeff(int index, int toCoeff){ changes the caller LieTreeVector by replacing its coefficient at the input index to the input Coefficient.

Usage note: The input Coefficient can be zero

RRROR: if ((index<0) || index>=numTerms)) throw IndexOutOfBoundException

===public void replace(int index, LieTree toTree){

  public void replaceByReference(int index, LieTree toTree){

change the caller LieTreeVector by replacing its tree (by reference if "replaceByReference" at the input index to the input LieTree, and update the isBasisIndexArrayFilled and isSimplified flags to false and the isLyndonForm flag according to if the changed LieTreeVector is in Lyndon Form.

Usage note: the input LieTree can be empty.

Caution: Use method "replace" rather "replaceByReference" if the input LieTree could be changedd after the method is called.

Develope note: 1. perhaps, if the basis index array was filled in the orginal, it would be a waste to simply throw all of those indices away just because the one input tree does not have its index filled. But this will depend on if the basis Index will remain in use for the sorting methods.


ERROR: if ((index<0) || (index>=numTerms)) throw IndexOutOfBoundException


=== public void replace(int index, int toCoeff, LieTree toTree){

   public void replaceByReference (int index, int toCoeff, LieTree toTree){


   	//ERROR:  if ((index<0) || index>=numTerms)) throw IndexOutOfBoundException



=== public void replace (int index, int toCoeff, LieTree toTree,int toBasisIndex){

public void replaceByReference (int index, int toCoeff, LieTree toTree,int toBasisIndex){
   	//ERROR:  if ((index<0) || index>=numTerms)) throw IndexOutOfBoundException


===public void replace (int index, LieTreeVector toLieTreeVector){
 
    public void replaceByReference (int index, LieTreeVector toLieTreeVector){

//ERROR: if ((index<0) || index+toLieTreeVector>=numTerms)) throw IndexOutOfBoundException //ERROR: if (!lyndonBasis.equalTo(toLieTreeVector.lyndonBasis) throw ElementsOfDifferentAlbebraException


==COPY METHODS

===public LieTreeVector copySubLieTreeVector(int startIndex, int endIndex) return a new LieTreeVector which contains the terms--coefficients, LieTrees and the basis indices if the basisIndexArray is filled, -- from the startIndex to the endIndex inclusive.The flags are the same as the original LieTreeVector. Error:

if the indices are out of bound, ie <0 or >=numTerms the IndexOutOfBoundException will be thrown. if the endIndex is smaller than the start Index, the EndIndexSmallerThanStartIndexException will be thrown


===public LieTreeVector copySubLieTreeVector(int startIndex)

return a new LieTreeVector which contains the terms--coefficients, LieTrees and the basis indices if the basisIndexArray is filled, -- from the startIndex to the last index (i.e. numTerms-1) inclusive.The flags are the same as the original LieTreeVector. Error:

if the indices are out of bound, ie <0 or >=numTerms the IndexOutOfBoundException will be thrown.


===public LieTreeVector makeCopy() return a new exact copy of the caller LieTreeVector.


===public LieTreeVector copySubLieTreeVectorByReference(int startIndex, int endIndex) return a LieTreeVector which contains the terms--coefficients, LieTrees by reference and the basis indices if the basisIndexArray is filled, -- from the startIndex to the endIndex inclusive.The flags are the same as the original LieTreeVector. Error:

if the indices are out of bound, ie <0 or >=numTerms the IndexOutOfBoundException will be thrown. if the endIndex is smaller than the start Index, the EndIndexSmallerThanStartIndexException will be thrown


CAUTION: The LieTrees are only copied by reference into the returned object; therefore use the method copySubLieTreeVector with the same arguments if there is a chance the caller LieTreeVector could be changed after this method is called. ===public LieTreeVector copySubLieTreeVectorByReference(int startIndex)

return a LieTreeVector which contains the terms--coefficients, LieTrees By reference and the basis indices if the basisIndexArray is filled, -- from the startIndex to the last index (i.e. numTerms-1) inclusive.The flags are the same as the original LieTreeVector. Error:

if the indices are out of bound, ie <0 or >=numTerms the IndexOutOfBoundException will be thrown.


CAUTION: The LieTrees are only copied by reference into the returned object; therefore use the method copySubLieTreeVector with the same arguments if there is a chance the caller LieTreeVector could be changed after this method is called.



==SORTING Method === private int rfindIndexInStringArray(String[] referenceArray,String treeFoliage,int startIndex, int upIntervalLength, int downIntervalLength) usage: it does not matter which LieTreeVector calls this method, it makes no difference


== private static int rfindIndexInIntArray(int[] referenceArray,int treeLyndonBasisIndex,int startIndex, int upIntervalLength, int downIntervalLength){


===public void fillBasisIndexArray() throws NotAlreadyInLyndonFormExcepttion Error: if the caller does not contain only Lyndon Basis elements (the Lyndon trees) check if the BasisIndexArray is already filled. If not, find identify which index each term with an element in thet Lyndon Basis of the same length, and record its index in the basis in the basisIndexArray.


Usage: before calling this method, the LieTreeVector has to contain only Lyndon trees. The mehtod reduceToLyndonForm() will reduce each term to a linear combination of lyndon trees and also fill in the basis index array.


==BOOLEAN and FLAG METHODS

=== public boolean isEmpty() return true if the LieTreeVector has 0 terms in it.

=== public boolean isLyndonForm() return true if every term is a Lyndon tree Note: this returns true if the caller is an empty LieTreeVector

=== public boolean isSimplified() returns true if all terms with the same basis vector (Lyndon Tree) have been added so that the LieTreeVector contains terms with only different Lyndon Trees.

Note: it returns true only if the "simplify()" method has been called, and that means if the the return value is true, the LieTreeVector is also sorted in length and alphabetical order.


=== public boolean isBasisIndexArrayFilled()


===private void updateFlags(LieTreeVector comparedToTreeVector) update the isLyndonForm, isSimplified, and isBasisIndexArrayFilled flags of the caller LieTreeVection by keeping the flags "true" ONLY if both the caller's and the arguments flags are true.

Usage: this is used in the replace/insert/append functions to update the isLyndonForm/isSimplified/isBasisIndexArrayFilled flags to the appropriate true or false value for the new LieTreeVector



=== private void updateFlags(LieTree comparedToTree){


set the isSimplified flag to false, the isLyndonForm flag to true ONLY if both the caller and the argument are Lyndon trees, and the isBasisIndexArrayFilled flag to false.

usage: used in append/insert/replace methods


=== private void updateFlags(LieTree comparedToTree, boolean basisIndexOfComparedToTreeExists)

set the isSimplified flag to false, the isLyndonForm flag to true ONLY if both the caller and the argument are Lyndon trees, and the isBasisIndexArrayFilled flag to the input value.

usage: used in append/insert/replace methods


==ACCESS METHOD

==SET METHOD

==FLAG/BOOLEAN METHODs


==MATHEMATICAL METHODS

===public LieTreeVector scalarMultiply(int inputScalar) return the scalar product of the caller LieTreeVector with the input scalar, i.e., a newLieTreeVector whose coefficients are the products of the caller's coefficients with the input Scalar


===public void scalarMultiplyChangeOriginal(int inputScalar) changes the coefficients of the caller LieTreeVector by their products with the inputScalar.


Developer's to do note: Allow the type of the scalar to be any scalar, especially big rational. Perhaps write a coeffients' class, like Siddarth did.



===public LieTreeVector add(LieTreeVector toAddTreeVector) throws NulllyndonBasisException.

The add function returns a new Lie Tree Vector object that is the sum of two LieTreeVectors in Lyndon basis form and is sorted in both word length and alphabetical order.

developement note: 1. To be efficient, It checks if either of inputLieTreeVector has already been simplified (using the isSimplified flag, i.e. reduced to Lyndon form, its basisIndexArray filled and with like terms collecteds and sorted. If both inputs are not simplified, then it simply append the second one to the first one, and call reduceToLyndonForm; otherwise, whichever one is simplified gets put as the first term, and the second one is reduced to Lyndon form and sorted into the first one.

2. Because of the append/copy/replace mechanisms, there is a chance (I need to check again) that a term with zero coefficient appears in the result. (when used in Mathematica it does not matter.

3. This simplification method relies on the identification of teh basis vector in each term in the whole basis set. This means that the whole Lyndon basis had to be created, and for 3 generators at word length 14, the basis contains >340000 elements, and takes up a lot of memory. In fact, the addition would have been as efficient ( I need to check still) if the lyndon Basis was not created, the basisIndex not filled, and the same binary sort algorithm used for sorting just among the two inputs, except now the sorting uses strings (or words) instead of the basis indices, which are integers.

4. Right now, if there are many repeated terms that are not lyndon words in the input LieTreeVectors, they dont' get collected together before being reduced to Lyndon Form; so that could take up a lot of time. The sorting should be done before as well.

5. Make the sorting more modular and modify the append/copy/replace/insert or create a method =that eliminates all the zero terms.


6. Would be good to use operators instead.



===public LieTreeVector reduceToLyndonForm(){ returns a a new LieTreeVector that contains only Lyndon trees and has its basisIndexArray filled

-if the flag isLyndonForm is false, reduce each term in the linear combination to linear combinations of Lyndon trees, and record that Lyndon tree index in the Lyndon basis. Returns a new LieTreeVector so that the caller LieTreeVector is not changed.

This method returns a new copy of the orginal LieTreeVector if it is already in LyndonForm. It always returns a new LieTreeVector that contains only the Lyndon trees.


note:if it was an empty LieTreeVector, a new empty LieTreeVector would be returned


===public LieTreeVector lieBracket(LieTreeVector inputTreeVector){ Error: If either the caller or the input LieTreeVector have NULL as their lyndonBasis, throw NOLyndonBasisException Error: If the lyndonBasis of the caller and the input are different, throw DifferentLFreeLieAlgebraElementsException

returns a new LieTreeVector that is the Lie Product of the caller LieTreeVector and the argument LieTreeVector.


It finds the Lie Bracket for each pair of LieTrees (using lieBracket method in Class Lie Tree), does the scalar multiplication and add each product to the final result using the add method form this class.

Usage: 1. Both the caller and input LieTreeVectors have to have their LyndonBasis reference initialized and be the same.

2,It is ok for either the caller or the input to be empty LieTreeVectors or both, a new empty LieTreeVector will be returned.