NumpyTensorSpace._lincomb¶
-
NumpyTensorSpace.
_lincomb
(self, a, x1, b, x2, out)[source]¶ Implement the linear combination of
x1
andx2
.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, b
TensorSpace.field
element Scalars to multiply
x1
andx2
with.- x1, x2
NumpyTensor
Summands in the linear combination.
- out
NumpyTensor
Tensor to which the result is written.
- a, b
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