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: Mon, 28 Apr 2008 09:04:02 +0200
User-agent: Thunderbird 2.0.0.12 (X11/20080306)

John W. Eaton wrote:
> On 27-Apr-2008, David Bateman wrote:
> 
> | Basically, as this is just a copy of the double precision type I'd
> | always thought it would be relatively easy to add this. With that idea I
> | didn't attempt to make template versions of the copied code to reuse it
> | and just copied it as the easier fashion to get this working. Therefore,
> | there might be some simplifications that might be done..
> 
> I'd been hoping to do this with templates and specializations.  Do you
> think it is worth doing that eventually?  It seems you should now have
> all (or most) of the specializations.

In fact most of the stuff in liboctave it probably doesn't make sense to
have templates as there is a lot of cases where the underlying code is
different (eg a call to sgetrf rather than dgetrf)..

There are probably lots of case in the oct-files that might be templated
but I didn't bother with. The octave-value classes themselves are
templated as they rely on octave_base_mat and octave_base_scalar.

> 
> | I've assumed that the correct mixed double/single behavior is to promote
> | the single type to double,
> 
> Yeah, you would think that would be the way it should work, but of
> course Matlab converts to single.

You're kidding.... That is just incorrect in terms of ensuring a
consistent precision. I assume the reason they did this is to allow
something like

single_arg + function_that_returns_double_for_single_arg(single_arg)

to return single. This allows some functions not to be converted to
handle singles and the majority of the calculation remaining in single
precision. If this is the case there might be a difference between the
treatment of operators and functions. For example, what about a mix of
single/double arguments to a function like  filter or betainc for
example, does it promote or demote the returned argument?

D.


reply via email to

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