C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

valarray?

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated)
View previous topic :: View next topic  
Author Message
Peter C. Chapin
Guest





PostPosted: Sun Jun 26, 2005 2:10 pm    Post subject: valarray? Reply with quote




The other day I was reading about std::valarray while waiting for a
doctor's appointment (it beats the magazines they usually have in the
waiting room). I've never needed to use valarray but I figured I might as
well learn about it. The ideas used seem pretty neat. I can see how the
various slicing features might be of interest to numerical folks. I can
also see how the interface would be awkward at best.

I realize that valarray is not generally liked. I'm curious now about its
future status. Are there going to be changes to valarray in the next C++
standard to address its issues?

Peter

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Back to top
Holger Sebert
Guest





PostPosted: Mon Jun 27, 2005 1:18 am    Post subject: Re: valarray? Reply with quote



Peter C. Chapin wrote:
Quote:
The other day I was reading about std::valarray while waiting for a
doctor's appointment (it beats the magazines they usually have in the
waiting room). I've never needed to use valarray but I figured I might as
well learn about it. The ideas used seem pretty neat. I can see how the
various slicing features might be of interest to numerical folks. I can
also see how the interface would be awkward at best.

I realize that valarray is not generally liked. I'm curious now about its
future status. Are there going to be changes to valarray in the next C++
standard to address its issues?

(Sorry, Peter, I think, I accidentally sent you this to your email address)


Hi,

my experience is that people doing numerics with C++ use libraries like
Blitz or they own specialized hand-coded classes.

In "The C++ Programming Language" it is said, that std::valarray is
meant as a means for easy building of matrix classes (using "slices" and
"generalized slices"). However, for sophisticated numerics this isn't
enough since their are so many special cases which need special types of
matrices (sparse, triangular, ...) and the corresponding vectors.

Normally, libraries that provide matrix classes also provide compatible
vector classes, which makes std::valarray superfluous.

So, I think std::valarray is useful for elementary numerics which do not
need other specialized data structures.

I, personally, like std::valarray because it is said (!) Wink that
compilers can "aggressively optimize" the code using std::valarray (e.g.
doing some SIMD stuff, etc.)

But I wonder if an implementation of the STL exists which exhaust these
possibilities of optimization. Does anyone know of any?

Regards,
Holger

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]


Back to top
glenlow@pixelglow.com
Guest





PostPosted: Tue Jun 28, 2005 9:59 am    Post subject: Re: valarray? Reply with quote



I have written a version of valarray that uses Altivec on PowerPC and
MMX/SSE/SSE2/SSE3 on Intel for optimizing. It comes in 9x-22x the speed
of the std::valarray on most platforms. Moreover because of the
expression template technique, I can reorganize certain valarray
expressions to use optimum sets of these SIMD opcodes e.g.

v1 * v2 + v3; // these are all valarrays

is automatically treated like fma (v1, v2, v3) which is faster on
Altivec.

Even the std::slice'ing uses Altivec, although I have not gotten a
decent speedup on slicing.

http://www.pixelglow.com/macstl/

Cheers,
Glen Low, Pixelglow Software
www.pixelglow.com


[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Back to top
benben
Guest





PostPosted: Wed Jun 29, 2005 8:30 am    Post subject: Re: valarray? Reply with quote


WOW!! Good job Glen!!
I think we are all looking foreward to more platform-dependent,
compiler-specific, very very very very dirty optimizations on valarray!!

ben



[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.