Vector Class Discussion

valarray class
Author: Agner Date: 2014-04-08 01:27
No, I have no plans of making a valarray template.
Please see the discussion at stackoverflow.com/questions/1602451/c-valarray-vs-vector

Suppose you have a large array and you want to do a series of calculations on each element. A valarray would do the first operation on all elements, store the results in a new temporary array; then do the next operation on all elements of the second array, and so on. This is expensive in terms of memory and cache operations. The idea of my vector class library is that the vector size matches an internal register in the CPU. When you do a series of calculations on a large array, you take out the first slice of, say, 8 elements and do the whole series of calculations on that slice. The values will stay in CPU registers through the whole series of calculations and you don't need any arrays for storing the intermediate values.

My plans for the vector class library is to include standard mathematical functions (exp, log, pow, sin, etc.) as inline code. Expect this within a few months. The forthcoming AVX-512 instruction set will double the size of vectors of float, double, and 32-bit and 64-bit integers. I am expecting this in 2016. I think Intel have plans for a 1024-bit extension in a more distant future, but we cannot expect the vector size to keep growing beyond 1024 bits.

 
thread valarray class new - Kyle Bentley - 2014-04-07
last replythread valarray class - Agner - 2014-04-08
last replythread valarray class new - Kyle Bentley - 2014-04-09
last reply valarray class new - Agner - 2014-04-10