UniversalSpace.lincomb¶
- UniversalSpace.lincomb(a, x1, b=None, x2=None, out=None)¶
Implement
out[:] = a * x1 + b * x2.This function implements
out[:] = a * x1or, if
bandx2are given,out = a * x1 + b * x2.- Parameters:
- a
fieldelement Scalar to multiply
x1with.- x1
LinearSpaceElement First space element in the linear combination.
- b
fieldelement, optional Scalar to multiply
x2with. Required ifx2is provided.- x2
LinearSpaceElement, optional Second space element in the linear combination.
- out
LinearSpaceElement, optional Element to which the result is written.
- a
- Returns:
- out
LinearSpaceElement Result of the linear combination. If
outwas provided, the returned object is a reference to it.
- out
Notes
The elements
out,x1andx2may be aligned, thus a callspace.lincomb(2, x, 3.14, x, out=x)is (mathematically) equivalent to
x = x * (2 + 3.14).