Skip to content

Commit 5b140db

Browse files
authored
implement dpnp.matvec and dpnp.vecmat (#2288)
In this PR, `dpnp.matvec` and `dpnp.vecmat` are implemented which are introduced in `numpy-2.2`.
1 parent 7a782ae commit 5b140db

9 files changed

+1664
-1136
lines changed

doc/reference/linalg.rst

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Matrix and vector products
2323
dpnp.outer
2424
dpnp.matmul
2525
dpnp.linalg.matmul (Array API compatible)
26+
dpnp.matvec
27+
dpnp.vecmat
2628
dpnp.tensordot
2729
dpnp.linalg.tensordot (Array API compatible)
2830
dpnp.einsum

dpnp/dpnp_iface.py

+27-6
Original file line numberDiff line numberDiff line change
@@ -322,14 +322,25 @@ def as_usm_ndarray(a, dtype=None, device=None, usm_type=None, sycl_queue=None):
322322
)
323323

324324

325-
def check_limitations(subok=False, like=None, initial=None, where=True):
325+
def check_limitations(
326+
subok=False,
327+
like=None,
328+
initial=None,
329+
where=True,
330+
subok_linalg=True,
331+
signature=None,
332+
):
326333
"""
327334
Checking limitation kwargs for their supported values.
328335
329-
Parameter `subok` is only supported with default value ``False``.
336+
Parameter `subok` for array creation functions is only supported with
337+
default value ``False``.
330338
Parameter `like` is only supported with default value ``None``.
331339
Parameter `initial` is only supported with default value ``None``.
332340
Parameter `where` is only supported with default value ``True``.
341+
Parameter `subok` for linear algebra functions, named as `subok_linalg`
342+
here, and is only supported with default value ``True``.
343+
Parameter `signature` is only supported with default value ``None``.
333344
334345
Raises
335346
------
@@ -341,22 +352,32 @@ def check_limitations(subok=False, like=None, initial=None, where=True):
341352
if like is not None:
342353
raise NotImplementedError(
343354
"Keyword argument `like` is supported only with "
344-
f"default value ``None``, but got {like}"
355+
f"default value ``None``, but got {like}."
345356
)
346357
if subok is not False:
347358
raise NotImplementedError(
348359
"Keyword argument `subok` is supported only with "
349-
f"default value ``False``, but got {subok}"
360+
f"default value ``False``, but got {subok}."
350361
)
351362
if initial is not None:
352363
raise NotImplementedError(
353364
"Keyword argument `initial` is only supported with "
354-
f"default value ``None``, but got {initial}"
365+
f"default value ``None``, but got {initial}."
355366
)
356367
if where is not True:
357368
raise NotImplementedError(
358369
"Keyword argument `where` is supported only with "
359-
f"default value ``True``, but got {where}"
370+
f"default value ``True``, but got {where}."
371+
)
372+
if not subok_linalg:
373+
raise NotImplementedError(
374+
"keyword argument `subok` is only supported with "
375+
f"default value ``True``, but got {subok_linalg}."
376+
)
377+
if signature is not None:
378+
raise NotImplementedError(
379+
"keyword argument `signature` is only supported with "
380+
f"default value ``None``, but got {signature}."
360381
)
361382

362383

0 commit comments

Comments
 (0)