octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Class of User Types [Was: Moving code from octave-forge to octave [W


From: Paul Kienzle
Subject: Re: Class of User Types [Was: Moving code from octave-forge to octave [Was: polyderiv problem?]]
Date: Fri, 25 Feb 2005 07:17:21 -0500


On Feb 25, 2005, at 4:20 AM, David Bateman wrote:



How do you save and load such beasts from files?

Does typeinfo give more complete information?

If the types really are not compatible, then the string names should not match.

Maybe class should return "GF(2)" if it is GF(2), and octave can pass the
extra info in the parentheses to the zeros constructor.

- Paul


Paul,

load/save is no problems, I just save which extension field of GF(2) I'm in an the primitive polynominal, together with the class. Its just another piece of information associated with the variable.

As for having class return all of the information on the type, I really hope your kidding. The problem is then that there are a huge number of different primitive polynomials available as we take larger extension fields of GF(2). For example GF(2^15) has 1800 different possible primitive polynomials. The problem is even worse for fixed point types, where each element of a matrix can have a different representation and each of those between 0 and 32 bits in the representation of the integer and decimal parts of the elements.

The implication that class returns the full information to define the type, is that there is a completely different type for all possible galois fields and fixed point matrices. Even if there were seperate types for each of the possibilities, imagine the number of different versions of the operators I'd need to implement, particularly for the fixed point types. In all practical senses this is not feasible.

For the fixed point types, having different representations doesn't make them incompatiable. All aritmetic operators can still be performed. However the same can not be said for galois fields. So I think for galois fields we just have to live with the return string of class being the same for incompatiable galois fields...


I was assuming a string containing 'class(subclass)' where octave used
'class' to determine which type to invoke and the type used 'subclass'
to decide what to do.  But no I'm not taking this idea very seriously.

Another alternative is to delay recording the primitive polynomial type
until something is actually assigned to the matrix, and from then on check
that it is consistent.  Would that work for you?

Or maybe something more generic, such as array(exemplar,dims) so that
dispatch will work.  Also, this makes more sense for some types such
as 'cell' for which I was assuming the zeros function would create a
set of empty cells.

Then triu would be:

   z = array(X,size(X));
   for i=1:columns(X), z(1:i,:) = X(1:i,:); end


Otherwise, zeros(dims,'auto',exemplar) does do what we want assuming
the class registers a zeros constructor.

- Paul




reply via email to

[Prev in Thread] Current Thread [Next in Thread]