Vous êtes un professionnel et vous avez besoin d'une formation ?
Sensibilisation àl'Intelligence Artificielle
Voir le programme détaillé
Module « numpy »
Signature de la fonction matvec
def matvec(*args, **kwargs)
Description
help(numpy.matvec)
matvec(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, axes, axis])
Matrix-vector dot product of two arrays.
Given a matrix (or stack of matrices) :math:`\mathbf{A}` in ``x1`` and
a vector (or stack of vectors) :math:`\mathbf{v}` in ``x2``, the
matrix-vector product is defined as:
.. math::
\mathbf{A} \cdot \mathbf{b} = \sum_{j=0}^{n-1} A_{ij} v_j
where the sum is over the last dimensions in ``x1`` and ``x2``
(unless ``axes`` is specified). (For a matrix-vector product with the
vector conjugated, use ``np.vecmat(x2, x1.mT)``.)
.. versionadded:: 2.2.0
Parameters
----------
x1, x2 : array_like
Input arrays, scalars not allowed.
out : ndarray, optional
A location into which the result is stored. If provided, it must have
the broadcasted shape of ``x1`` and ``x2`` with the summation axis
removed. If not provided or None, a freshly-allocated array is used.
**kwargs
For other keyword-only arguments, see the
:ref:`ufunc docs <ufuncs.kwargs>`.
Returns
-------
y : ndarray
The matrix-vector product of the inputs.
Raises
------
ValueError
If the last dimensions of ``x1`` and ``x2`` are not the same size.
If a scalar value is passed in.
See Also
--------
vecdot : Vector-vector product.
vecmat : Vector-matrix product.
matmul : Matrix-matrix product.
einsum : Einstein summation convention.
Examples
--------
Rotate a set of vectors from Y to X along Z.
>>> a = np.array([[0., 1., 0.],
... [-1., 0., 0.],
... [0., 0., 1.]])
>>> v = np.array([[1., 0., 0.],
... [0., 1., 0.],
... [0., 0., 1.],
... [0., 6., 8.]])
>>> np.matvec(a, v)
array([[ 0., -1., 0.],
[ 1., 0., 0.],
[ 0., 0., 1.],
[ 6., 0., 8.]])
Vous êtes un professionnel et vous avez besoin d'une formation ?
Programmation Python
Les compléments
Voir le programme détaillé
Améliorations / Corrections
Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.
Emplacement :
Description des améliorations :