Brainstorming: Noise optimization
#41
I just thought of a rediculous way of doing c++ and SSE in one codebase with efficient vector ops. Since c++ template classes can be equivalent to S-Expressions.
Code:
template<class T, class U> class VectorAdd { VectorAdd( T a_x, U a_y) : m_x(a_x),m_y(a_y) { } T m_x; U m_y; template<class V> Vector<V> Evaluate() { Vector<V> z; for(int i =0; i < m_x.size(); i++) { z[i] = Evaluate(i) } return z; } template<class V> V Evaluate(int i) { return m_x.Evalute(i) + m_y.Evaluate(i) } }
This can then be inlined down to a simple c++ maths equation or sequence of SSE ops and the code using it would look like:
Code:
Vector<int> x; Vector<int> y; Vector<int> z = VectorAdd(VectorMultiply(x,y),y);
Don't think I can implement it immediately as I have major exams coming up but it would be an interesting summer project.
Reply
Thanks given by:


Messages In This Thread
Brainstorming: Noise optimization - by xoft - 03-28-2013, 05:54 AM
RE: Brainstorming: Noise optimization - by xoft - 03-28-2013, 07:29 AM
RE: Brainstorming: Noise optimization - by ThuGie - 01-15-2014, 10:29 AM
RE: Brainstorming: Noise optimization - by xoft - 01-15-2014, 10:56 PM
RE: Brainstorming: Noise optimization - by xoft - 01-16-2014, 06:18 AM
RE: Brainstorming: Noise optimization - by xoft - 01-17-2014, 05:06 AM
RE: Brainstorming: Noise optimization - by ThuGie - 01-17-2014, 07:17 AM
RE: Brainstorming: Noise optimization - by xoft - 01-18-2014, 08:13 AM
RE: Brainstorming: Noise optimization - by xoft - 01-19-2014, 01:02 AM
RE: Brainstorming: Noise optimization - by xoft - 01-19-2014, 01:20 AM
RE: Brainstorming: Noise optimization - by xoft - 01-19-2014, 01:45 AM
RE: Brainstorming: Noise optimization - by xoft - 01-19-2014, 02:05 AM
RE: Brainstorming: Noise optimization - by xoft - 01-19-2014, 07:29 AM
RE: Brainstorming: Noise optimization - by xoft - 01-19-2014, 05:14 PM
RE: Brainstorming: Noise optimization - by xoft - 01-24-2014, 06:37 PM
RE: Brainstorming: Noise optimization - by worktycho - 05-08-2014, 02:04 AM



Users browsing this thread: 1 Guest(s)