numpoly.copyto

numpoly.copyto(dst: numpoly.baseclass.ndpoly, src: numpoly.typing.PolyLike, casting: str = 'same_kind', where: Union[numpy._typing._array_like._SupportsArray[numpy.dtype], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]] = True)None[source]

Copy values from one array to another, broadcasting as necessary.

Raises a TypeError if the casting rule is violated, and if where is provided, it selects which elements to copy.

Args:
dst:

The array into which values are copied.

src:

The array from which values are copied.

casting:

Controls what kind of data casting may occur when copying.

  • ‘no’ means the data types should not be cast at all.

  • ‘equiv’ means only byte-order changes are allowed.

  • ‘safe’ means only casts which can preserve values are allowed.

  • ‘same_kind’ means only safe casts or casts within a kind,

    like float64 to float32, are allowed.

  • ‘unsafe’ means any data conversions may be done.

where:

A boolean array which is broadcasted to match the dimensions of dst, and selects elements to copy from src to dst wherever it contains the value True.

Example:
>>> q0 = numpoly.variable()
>>> poly1 = numpoly.polynomial([1, q0**2, q0])
>>> poly2 = numpoly.polynomial([2, q0, 3])
>>> numpoly.copyto(poly1, poly2, where=[True, False, True])
>>> poly1
polynomial([2, q0**2, 3])
>>> numpoly.copyto(poly1, poly2)
>>> poly1
polynomial([2, q0, 3])