1. A method for generating a result vector, comprising: receiving a first input vector, a second input vector, a third input vector, and a control vector, wherein each vector includes N elements; setting a base value equal to a value from an element at a key element position in the first input vector; and generating the result vector, wherein generating the result vector comprises: for each element of the result vector to the right of the key element position, setting the element in the result vector equal to a sum of the base value and a result of multiplying a value in each relevant element of the second input vector by a value in a corresponding element of the third input vector, from an element at the key element position to and including a predetermined element in the second input vector.