-
Notifications
You must be signed in to change notification settings - Fork 161
Open
Labels
c++Items which involve writing in C++Items which involve writing in C++hackathonIssues potentially suitable for a hackathon exerciseIssues potentially suitable for a hackathon exercise
Milestone
Description
The rectangular array class RectArray
(and by extension the Matrix
and SquareMatrix
classes) is one of the few remaining places in which Gambit directly handles memory allocation/deallocation via new
/delete
.
We want to modernise the implementation of these classes.
- The current implementation of
RectArray
is a pointer-to-pointer setup, with the index into the first pointer being the row and the second being the column. This should be replaced with a singlestd::vector
, in which the contents are "raveled" and we handle the offset arithmetic to find the appropriate element rather than relying on C-style pointer arithmetic. (Note that helpfully ourRectArray
is actually not resizeable at present; there was a resizeable version of this historically but it's no longer needed, which makes re-implementation a bit easier).
2.. Based on similar experience with the parallel one-dimensional Array
and Vector
classes, Matrix
should not be derived from RectArray
but instead a Matrix
should just have a RectArray
as a data member. This refactoring should be done.
- Classes which represent a row and a column of the
RectArray
should be created and provided. These should be useful in simplifying (and making more efficient) some of the operations currently provided in getting/setting rows and columns of theRectArray
. For example, there are cases in whichGetRow
andGetColumn
is filling anArray
orVector
simply so the resulting data can be used in that container, but actually the calling code could be more generic and use a class which presents a slice of theRectArray
as a one-dimensional object, which would eliminate unnecessary copying. it may be beyond the scope of this issue fully to change all such uses, but the re-design of the class should set up such access.
Metadata
Metadata
Assignees
Labels
c++Items which involve writing in C++Items which involve writing in C++hackathonIssues potentially suitable for a hackathon exerciseIssues potentially suitable for a hackathon exercise