Class ATopLevelBlock
java.lang.Object
solvers.linearSystem.btf.ComponentBlock
solvers.linearSystem.btf.topLevelBlocks.TopLevelBlock
solvers.linearSystem.btf.topLevelBlocks.ATopLevelBlock
This class extends TopLevelBlock to also include a list of SecondaryMacroBlocks.
This is required of the two blocks of the A matrix: XBlock and YBlock
- Author:
- Jack Bradshaw
-
Field Summary
FieldsFields inherited from class TopLevelBlock
macro_blocks, selection_policyFields inherited from class ComponentBlock
basis, cols_printed, current_class, position, qnm, size -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedATopLevelBlock(QNModel qnm, CoMoMBasis basis, Position position) Constructor - First phase of creation, does not initialise MacroBlocks or SecondaryMacroBlocksprotectedATopLevelBlock(ATopLevelBlock full_block, int current_class) Copy Constructor -
Method Summary
Modifier and TypeMethodDescriptionintaddCE(int position, PopulationChangeVector n, int queue) Adds the appropriate coefficients of a Convolution Expression to the blockintaddPC(int position, PopulationChangeVector n, int _class) Adds the appropriate coefficients of a Population Constraint to the blockvoidinitialise() overridden to further create list of SecondaryMacroBlocksvoidmultiply(BigRational[] result) Carries out the appropriate matrix multiplication operation for the blockprotected abstract voidnewSecondaryMacroBlock(int h, MacroBlock block_1, MacroBlock block_2) Factory Method for Secondary Macro Blocks To be overridden by subclasses in order to create the appropriate subclass of SecondaryMacroBlock in the parallel hierarchy.voidsolve(BigRational[] rhs) Makes the block carry out its role in the solution of the linear systemsubBlock(int current_class) Builder method that encapsulates the creation of sub-ATopLevelBlocks Fills list of MacroBlocks as super class.Methods inherited from class TopLevelBlock
findMacroBlock, newMacroBlock, printRow2, subBlockCopyMethods inherited from class ComponentBlock
getStartingCol, getStartingRow, newLine, size
-
Field Details
-
sec_macro_blocks
-
-
Constructor Details
-
ATopLevelBlock
protected ATopLevelBlock(QNModel qnm, CoMoMBasis basis, Position position) throws BTFMatrixErrorException, InternalErrorException, InconsistentLinearSystemException Constructor - First phase of creation, does not initialise MacroBlocks or SecondaryMacroBlocks- Parameters:
qnm-basis-position-- Throws:
BTFMatrixErrorExceptionInternalErrorExceptionInconsistentLinearSystemException- See Also:
-
ATopLevelBlock
protected ATopLevelBlock(ATopLevelBlock full_block, int current_class) throws BTFMatrixErrorException Copy Constructor- Throws:
BTFMatrixErrorException
-
-
Method Details
-
subBlock
public TopLevelBlock subBlock(int current_class) throws BTFMatrixErrorException, InternalErrorException, InconsistentLinearSystemException Builder method that encapsulates the creation of sub-ATopLevelBlocks Fills list of MacroBlocks as super class. Fills list of SecondaryMacroBlocks.- Overrides:
subBlockin classTopLevelBlock- Parameters:
current_class- The class for which the copy is created- Returns:
- A shallow copy of calling block, containing the correct macro blocks for the current_class
- Throws:
BTFMatrixErrorExceptionInternalErrorExceptionInconsistentLinearSystemException
-
initialise
public void initialise() throws BTFMatrixErrorException, InternalErrorException, InconsistentLinearSystemExceptioninitialise() overridden to further create list of SecondaryMacroBlocks- Overrides:
initialisein classTopLevelBlock- Throws:
BTFMatrixErrorExceptionInternalErrorExceptionInconsistentLinearSystemException
-
addCE
public int addCE(int position, PopulationChangeVector n, int queue) throws BTFMatrixErrorException, InternalErrorException Description copied from class:ComponentBlockAdds the appropriate coefficients of a Convolution Expression to the block- Overrides:
addCEin classTopLevelBlock- Parameters:
position- Carries information on where to insert the equation depending on the context (can be interpreted differently by subclasses)n- The Population Change Vector n to which the equation relatesqueue- The queue k to which the equation relates; 1 <= k <= M- Returns:
- The row at which the equation was inserted
- Throws:
BTFMatrixErrorExceptionInternalErrorException
-
newSecondaryMacroBlock
protected abstract void newSecondaryMacroBlock(int h, MacroBlock block_1, MacroBlock block_2) throws BTFMatrixErrorException Factory Method for Secondary Macro Blocks To be overridden by subclasses in order to create the appropriate subclass of SecondaryMacroBlock in the parallel hierarchy.- Parameters:
h-block_1-block_2-- Throws:
BTFMatrixErrorException
-
addPC
public int addPC(int position, PopulationChangeVector n, int _class) throws BTFMatrixErrorException, InternalErrorException Description copied from class:ComponentBlockAdds the appropriate coefficients of a Population Constraint to the block- Overrides:
addPCin classTopLevelBlock- Parameters:
position- Carries information on where to insert the equation depending on the context (can be interpreted differently by subclasses)n- The Population Change Vector n to which the equation relates_class- The class r to which the equation relates; 1 <= r <= R- Returns:
- The row at which the equation was inserted
- Throws:
BTFMatrixErrorExceptionInternalErrorException
-
multiply
Description copied from class:ComponentBlockCarries out the appropriate matrix multiplication operation for the block- Overrides:
multiplyin classTopLevelBlock- Parameters:
result- Result vector- Throws:
BTFMatrixErrorException
-
solve
public void solve(BigRational[] rhs) throws BTFMatrixErrorException, OperationNotSupportedException, InconsistentLinearSystemException, InternalErrorException Description copied from class:ComponentBlockMakes the block carry out its role in the solution of the linear system- Overrides:
solvein classTopLevelBlock- Parameters:
rhs- The intermediate basis used during the computation of the solution- Throws:
BTFMatrixErrorExceptionOperationNotSupportedExceptionInconsistentLinearSystemExceptionInternalErrorException
-