[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: making element_type NDArray parent classes of element_type Matrix
From: |
Carnë Draug |
Subject: |
Re: making element_type NDArray parent classes of element_type Matrix |
Date: |
Wed, 29 Oct 2014 19:28:33 +0000 |
On 24 October 2014 01:04, Carnë Draug <address@hidden> wrote:
> On 22 October 2014 00:00, Carnë Draug <address@hidden> wrote:
>> Hi
>>
>> at the moment, both Matrix and NDArray classes are derived from
>> Array<element_type>. I may be missing something but I think it makes
>> more sense to have the Matrix classes derive from a NDArray of the
>> corresponding element_type.
>>
>> For starters, I did this for boolMatrix and boolNDArray [1]. It is
>> building fine and make check is successful. I would continue this but
>> maybe others have different opinions on what things should derive
>> from.
>>
>> There is also the case to have Matrix classes inherit from both an
>> AbstractMatrix and element_type NDArray, but that may complicate
>> things too much for very little gain (or any gain?).
>>
>> The specific thing that triggered this was trying to implement the
>> bitpack and bitunpack as boolNDArray methods [2]. That's when I
>> noticed that implementing on boolNDArray would not make it available
>> for boolMatrix
>>
>> Could anyone comment on this change? If we are going to change where
>> things derive from, we may as well go for broke and make other bigger
>> changes that may have been hold back to not break existing code.
>>
>> Carnë
>>
>> [1] https://bpaste.net/show/6b5a03b8bda3
>> [2]
>> http://lists.gnu.org/archive/html/octave-maintainers/2014-10/msg00053.html
>
> For those who would like to have a graphical view of our class
> inheritance tree, see
> http://octave.sourceforge.net/doxygen41/inherits.html
>
> I am not trying to do with charMatrix and charNDArray what I did to bool.
I have submitted a patch to the tracker for review [1].
Carnë
[1] https://savannah.gnu.org/patch/index.php?8561