mirror of
https://github.com/python/cpython.git
synced 2025-10-08 08:01:55 +00:00
PEP 465: a dedicated infix operator for matrix multiplication (closes #21176)
This commit is contained in:
parent
2aad6ef774
commit
d51374ed78
42 changed files with 803 additions and 442 deletions
|
@ -1495,6 +1495,18 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
|
|||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(BINARY_MATRIX_MULTIPLY) {
|
||||
PyObject *right = POP();
|
||||
PyObject *left = TOP();
|
||||
PyObject *res = PyNumber_MatrixMultiply(left, right);
|
||||
Py_DECREF(left);
|
||||
Py_DECREF(right);
|
||||
SET_TOP(res);
|
||||
if (res == NULL)
|
||||
goto error;
|
||||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(BINARY_TRUE_DIVIDE) {
|
||||
PyObject *divisor = POP();
|
||||
PyObject *dividend = TOP();
|
||||
|
@ -1685,6 +1697,18 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
|
|||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(INPLACE_MATRIX_MULTIPLY) {
|
||||
PyObject *right = POP();
|
||||
PyObject *left = TOP();
|
||||
PyObject *res = PyNumber_InPlaceMatrixMultiply(left, right);
|
||||
Py_DECREF(left);
|
||||
Py_DECREF(right);
|
||||
SET_TOP(res);
|
||||
if (res == NULL)
|
||||
goto error;
|
||||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(INPLACE_TRUE_DIVIDE) {
|
||||
PyObject *divisor = POP();
|
||||
PyObject *dividend = TOP();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue