|[eigen] help speeding up an expression?|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: [eigen] help speeding up an expression?
- From: Dick Lyon <dicklyon@xxxxxxxxxx>
- Date: Fri, 2 Aug 2013 14:25:35 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=pg21HvsPbkXAx/wX1f8aiIMyhlmlKPdokrXNC1mDPOs=; b=nNyjQcgixEIEFqV4+NntxE+Gt1eFfNJfAeI+ax8htnSDTigMTTpAg+1t+iQhymIsLn ty88s6Q7IEODKg06g4mAICkFw+R662dmmNCvJmEoLiY9gJGm9Dok+VZCAk8XlkPCGU7w EjrfEe2jBFDat34cGiBYBqpEDuh4onGI4GH9a1kUOmaMSCEhoXQw0bRexQzmfoAsXNUn JnPd/jqHcJ/U7ijZdHrtLPo0c3iCBoIr/iP6r8YmGraI8WGDydbDreIEIuvPrCL6p0jH hMeVKHQRGqNB9nOGp37Sbgc4A/Qgx8p4wxo+fcDOUvlXX1ijC3wCfYcveun0nBGz9jHg KlKQ==
Has anyone got tips on how to speed up this eigen code that is the slowest part of my process?
Simplified, I have this in an inline function definition with argument ArrayXf& z:
z += 0.175;
z = (z < 0).select(0.0, (z*z*z) / (z*z*z + z*z + 0.1));
Can this be sped up by clever use of pre-allocated temp arrays? Or is eigen already more clever than anything I'd likely come up with? And how can I tell, or where should I look to learn more about how to think about optimizing such things?
Is select fast? Or are there better ways to threshold things?
I'm on an Intel platform, but ultimately also targeting Arm NEON, in case that matters.