1. A method for generating a result vector, comprising: in a processor, performing operations for: receiving a first input vector, a second input vector, a third input vector, and a control vector, wherein each vector includes a same number of 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 each 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, wherein a relevant element is an element for which a corresponding element in the control vector is active.