Saxpy, namely z = a * x + y, is a very common operation to be performed in scientific programming.
cuBLAS implements its own saxpy, but it is limited to the case when z = y, so in some circumstances it has to be implemented using a kernel function or using CUDA Thrust.
On our GitHub website, a fully worked example is shown on how implementing saxpy in CUDA using Thrust and, in particular, using the placeholder technique.
A fully worked example is also reported on how implementing saxpy in CUDA using lambda expressions. Using lambda expressions for device operations is only available since CUDA 8.0 and it is experimental at this stage.