Open kocotom opened 3 months ago
Attention: Patch coverage is 98.13433%
with 5 lines
in your changes missing coverage. Please review.
Project coverage is 73.90%. Comparing base (
278a599
) to head (9067a1f
). Report is 17 commits behind head on devel.:exclamation: Current head 9067a1f differs from pull request most recent head f37352b
Please upload reports for the commit f37352b to get more accurate results.
Files | Patch % | Lines |
---|---|---|
include/mata/utils/extendable-square-matrix.hh | 96.80% | 0 Missing and 3 partials :warning: |
src/partition.cc | 98.78% | 0 Missing and 2 partials :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Thank you for the PR. I will be reviewing the PR throughout the week. Is that good enough for your needs?
@Adda0 Thanks for your reaction, yes, that is ok!
I have just made few little changes:
isReflexive
, isAntisymetric
, isTransitive
are now methods of the ExtendableSquareMatrix
structure, they are not ordinary functions anymorecreate
, it is a factory function which creates an ExtendableSquareMatrix
instance depending on a given typecopy
, its purpose is to create a deep copy of ExtendableSquareMatrix
depending of its typeI have just made one more little change:
copy constructor
for the structure Partition
operator=
for the structure Partition
which preserves information about the capacity of the partition vectorscopy constructor
and operator=
I have just realized that I had passed several vectors to functions without using constant reference even though these vectors are not modified within corresponding functions, so I have fixed it. Namely:
StateBlocks partition = StateBlocks()
changed to const StateBlocks& partition = StateBlocks()
in Partition
structure constructorstd::vector<State> marked
changed to const std::vector<State>& marked
in Partition::splitBlocks
methodstd::vector<State> states
changed to const std::vector<State>& states
in Partition::inSameBlock
methodHey. Sorry for the delay. Still working on it. Things got in the way.
I have just did one more little change. I have deleted the copy
function which had cretead a deep copy of a given ExtendableSquareMatrix
instance.
Instead, I have replaced it with a pure virtual method clone
which is a part of the ExtendableSquareMatrix
structure. Each substructure reimplements it on its own. I think this is a better solution for this problem.
Thanks for your suggestions. I have resolved several of them and I will continue later today. The last fix caused few unsuccessful checks but I have not discovered the cause yet, I will inspect it more thoroughly later today.
I have made several changes in the Partition
class inner logic to make it easier to manipulate with that data structure.
In the previous version, BlockItem
, Block
and Node
were simple structures whose only purpose was to store various indices of partition vectors. The matching of the corresponding structures was done using several methods like get_node_idx_from_block_item_idx
and so on.
In the current version, BlockItem
, Block
and Node
are private classes defined inside of the Partition
class. They still store indices of the partition vectors but they also contain methods which simplify manipulation with the partition.
class BlockItem
idx_
- index of the block_items_
vector corresponding to itselfstate_
- corresponding stateblock_idx_
- index of the corresponding blockpartition_
- const reference to the partitionidx
and state
gettersblock
- returns a const reference to the corresponding blocknode
- returns a const reference to the corresponding noderepr
- returns a const reference to the corresponding representativeclass Block
idx_
- index of the blocks_
vector corresponding to itselfnode_idx_
- index of the corresponding nodepartition_
- const reference to the partitionidx
getternode
- returns a const reference to the corresponding noderepr
- returns a const reference to the corresponding representativefirst
- returns a const reference to the first corresponding block itemlast
- returns a const reference to the last corresponding block itembegin
and end
- return const iterators which enable using iteration through the blockclass Node
idx_
- index of the nodes_
vector corresponding to itselffirst_
- index of the first block item in the nodelast_
- index of the last block item in the nodepartition_
- const reference to the partitionidx
getterrepr
- returns a const reference to the corresponding representativefirst
- returns a const reference to the first corresponding block itemlast
- returns a const reference to the last corresponding block itembegin
and end
- return const iterators which enable using iteration through the nodeThe other methods were changed to reflect the current representation of the partition.
This looks beautiful. I will review the changes during this week. The description above looks great, though.
I have implemented two data structures:
Partition
, an efficient representation of set partition with the ability toExtendableSquareMatrix
, an abstract representation of binary relation over a set, a matrix of counters etc. with the ability ton x n
matrix to the(n+1) x (n+1)
matrix (ifn < capacity
)I have also implemented three concrete representations of the
ExtendableSquareMatrix
which inherit from that structure and implement the virtual methods get, set and extend:CascadeSquareMatrix
(I'm not sure whether the name is appropriate)DynamicSquareMatrix
HashedSquareMatrix
These data structures are implemented in the file
partition-relation-pair.hh
. Soon there will be a data structurePartitionRelationPair
which use combination ofPartition
andExtendableSquareMatrix
but it is not fully done yet so I have not included it.I have also added a lot of tests which work with these data structures.
The code is massively commented to ease understanding.