octave-maintainers
[Top][All Lists]
Advanced

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

Re: [CHANGESET]: First attempt at a single precision type.


From: David Bateman
Subject: Re: [CHANGESET]: First attempt at a single precision type.
Date: Thu, 01 May 2008 00:43:57 +0200
User-agent: Thunderbird 2.0.0.12 (X11/20080306)

John W. Eaton wrote:
> On 30-Apr-2008, David Bateman wrote:
> 
> | John W. Eaton wrote:
> | > On 30-Apr-2008, John W. Eaton wrote:
> | > 
> | > | Did you mean to write this as
> | > | 
> | > |   ComplexMatrix ComplexMatrix::stack (const Matrix&) const
> | > |   {
> | > |     return MArray2<ComplexMatrix>::stack (a);
> | > |   }
> | > | 
> | > | in the ComplexMatrix class?
> | > 
> | > Oops, I meant "MArray2<complex>::stack (a)".
> | 
> | Or even "MArray2<Complex>::stack(a)", sorry the fault was only in the
> | e-mail not in what I implemented.. Thinking about the problem is
> | probably that the template needs to be instantiated somewhere, though I
> | thought the call to the templated method should have done that itself..
> | I think I see in any case why these functions haven't been templated in
> | the past :-)
> 
> OK, it will work with the following function in MArray2.h:
> 
>   template <class U>
>   MArray2<T> stack (const MArray2<U>&) const
>   {
>     ...
>   }
> 
> and the following in CMatrix.cc:
> 
>   ComplexMatrix
>   ComplexMatrix::stack (const Matrix& a) const
>   {
>     return MArray2<Complex>::stack (a);
>   }

THis is what I had, but in CMatrix.h

> Of course it would be better to put this in CMatrix.h so it could be
> inlined.  To do that, you'll need to include Matrix.h in CMatrix.h.
> Without that, it fails because Matrix is not a complete type at the
> time CMatrix.h is parsed (I think).  The error message from g++ didn't
> really help me zero in on the problem immediately...

The error message didn't even reference Matrix!!! Ok, it seems to work.

> Something else to consider is that these are binary operations, so
> maybe they should't be member functions?  These are some of the older
> function in liboctave which were written when I didn't really know
> what I was doing (as if I do now).

Or maybe they shouldn't exist at all... Where are stack, extract,
extract_n actually used in Octave? If it is used could the call be
replaced will something else? As far as I can see extract_n and stack
aren't used and extract is only used in the pseudo_inverse method. Can
we just drop these methods or is there code external to Octave that
relies on them? This stuff seems like cruft to me..

D.


reply via email to

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