[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: plans for single-precision support?
From: |
Martin Helm |
Subject: |
Re: plans for single-precision support? |
Date: |
Wed, 1 Sep 2010 13:53:13 +0200 |
User-agent: |
KMail/1.13.5 (Linux/2.6.31.12-0.2-desktop; KDE/4.4.4; x86_64; ; ) |
Am Mittwoch, 1. September 2010, 08:23:38 schrieb Tim Rueth:
> > -----Original Message-----
> > From: Tatsuro MATSUOKA [mailto:address@hidden
> > Sent: Tuesday, August 31, 2010 9:40 PM
> > To: address@hidden; 'Martin Helm'; address@hidden
> > Subject: RE: plans for single-precision support?
> >
> > Hello
> >
> > It seems that octave-3.2.3/MinGW32 supports the 'single' function.
> >
> >
> > **************************************************************
> > *************
> > GNU Octave, version 3.2.3
> > Copyright (C) 2009 John W. Eaton and others.
> > This is free software; see the source code for copying conditions.
> > There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY
> > or FITNESS FOR A PARTICULAR PURPOSE. For details, type `warranty'.
> >
> > Octave was configured for "i686-pc-mingw32".
> >
> > Additional information about Octave is available at
> > http://www.octave.org.
> >
> > Please contribute if you find this software useful.
> > For more information, visit http://www.octave.org/help-wanted.html
> >
> > Report bugs to <address@hidden> (but first, please read
> > http://www.octave.org/bugs.html to learn how to write a
> > helpful report).
> >
> > For information about changes from previous versions, type `news'.
> >
> > warning: mark_as_command is obsolete and will be removed from
> > a future version of Octave
> > octave-3.2.3.exe:1:C:\Programs\Octave\3.2.3_gcc4.4.0\bin
> >
> > > help single
> >
> > `single' is a built-in function
> >
> > -- Built-in Function: single (X)
> >
> > Convert X to single precision type.
> >
> > See also: double
> >
> > Additional help for built-in functions and operators is
> > available in the on-line version of the manual. Use the
> > command `doc <topic>' to search the manual index.
> >
> > Help and information about Octave is also available on the
> > WWW at http://www.octave.org and via the address@hidden mailing list.
> >
> > octave-3.2.3.exe:11:C:\Programs\Octave\3.2.3_gcc4.4.0\bin
> >
> > > x=0.1
> >
> > x = 0.100000000000000
> > octave-3.2.3.exe:12:C:\Programs\Octave\3.2.3_gcc4.4.0\bin
> >
> > > y=single(x)
> >
> > y = 0.100000001490116
> > octave-3.2.3.exe:13:C:\Programs\Octave\3.2.3_gcc4.4.0\bin
> >
> > > whos
> >
> > Variables in the current scope:
> > Attr Name Size Bytes Class
> > ==== ==== ==== ===== =====
> >
> > x 1x1 8 double
> > y 1x1 4 single
> >
> > Total is 2 elements using 12 bytes
> >
> > **********************************************************************
> >
> > If you want to install octave-3.2.4/mingw32, please read
> > carefully the below, (The oct2mat issue should be treated in
> > case installing the whole octave-forge package.)
> >
> > http://wiki.octave.org/wiki.pl?OctaveForWindows
> >
> > Regards
> >
> > Tatsuro
> >
> > --- Tim Rueth wrote:
> > > Oh, I'm still running 3.2.3 (Vista). I should upgrade to
> >
> > 3.2.4 then.
> >
> > > I'm running into memory problems, and I'm hoping that if I
> >
> > change some
> >
> > > of my matrices from double to single I can cut the memory
> >
> > requirements way down.
> >
> > > --Tim
> > >
> > > > -----Original Message-----
> > > > From: Martin Helm [mailto:address@hidden
> > > > Sent: Tuesday, August 31, 2010 3:20 PM
> > > > To: address@hidden; address@hidden
> > > > Subject: Re: plans for single-precision support?
> > > >
> > > > Am Dienstag, 31. August 2010, 23:26:47 schrieb Tim Rueth:
> > > > > Does anyone know when single-precision data types,
> >
> > i.e., single(),
> >
> > > > > will be supported?
> > > > >
> > > > > --Tim
> > > >
> > > > Maybe I do not understand your question, single() is available in
> > > > octave 3.2.4.
>
> Oh, you're right. I read in the Octave Manual for single() that:
>
> Note: this function currently returns its argument converted to
> double precision
> because Octave does not yet have a single-precision numeric data
> type.
>
> But I tried your test case and sure enough, it works, thanks.
>
> Since it appears Octave defaults to double, I'm still having to initially
> allocate memory for twice the space that I need, then I give back half.
> I'm using ndgrid() to create numerous very large matrices. Is there a way
> to invoke ndgrid() so that it just creates single-precision matrices
> without recasting them from double back to single?
>
> Thanks,
>
> --Tim
Create your matrices and vectors initialy as single and do not cast them
a = zeros(3,3, "single");
class(a)
ans = single
Pass only "single" arguments to ndgrid.