Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fastest way to find max element in vector



On 21/11/2005, at 7:02 PM, Rustam Muginov wrote:

Hello, all.
What is the fastest way to find the largest element across the vector (vFloat) ?
Currently i am saving it to the memory and performing scalar compare, but this should be more logical and fast way to to so.
Thank you.
--
Sincerely,
Rustam Muginov

Rustam:

My macstl library has a max member function for all SIMD types and works portably across Altivec and SSE e.g.

using namespace macstl;
vec <float> f (1, 2, 3, 4);
float maxf = f.max ();	// should be 4

http://www.pixelglow.com/macstl

It uses SIMD intrinsics to compute this so there's little scalar overhead, except for the last conversion to scalar. It also generalizes to arrays of types (using C++ valarrays) if you so wish.

Cheers, Glen Low


--- pixelglow software | simply brilliant stuff www.pixelglow.com aim: pixglen

_______________________________________________
Do not post admin requests to the list. They will be ignored.
PerfOptimization-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/perfoptimization-dev/email@hidden

This email sent to email@hidden
References: 
 >Fastest way to find max element in vector (From: Rustam Muginov <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.