NumpyTensorSpace._lincomb

NumpyTensorSpace._lincomb(self, a, x1, b, x2, out)[source]

Implement the linear combination of x1 and x2.

Compute out = a*x1 + b*x2 using optimized BLAS routines if possible.

This function is part of the subclassing API. Do not call it directly.

Parameters
a, bTensorSpace.field element

Scalars to multiply x1 and x2 with.

x1, x2NumpyTensor

Summands in the linear combination.

outNumpyTensor

Tensor to which the result is written.

Examples

>>> space = odl.rn(3)
>>> x = space.element([0, 1, 1])
>>> y = space.element([0, 0, 1])
>>> out = space.element()
>>> result = space.lincomb(1, x, 2, y, out)
>>> result
rn(3).element([ 0.,  1.,  3.])
>>> result is out
True