From d0edfe79ed5eae461e64c51bee7f4d6fe3e10165 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Thu, 13 Feb 2025 08:12:18 -0800 Subject: [PATCH 1/2] Allocate C order array for q in dpnp.linalg.qr() --- dpnp/linalg/dpnp_utils_linalg.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dpnp/linalg/dpnp_utils_linalg.py b/dpnp/linalg/dpnp_utils_linalg.py index f105cff5a6c2..1a2ac0c99f57 100644 --- a/dpnp/linalg/dpnp_utils_linalg.py +++ b/dpnp/linalg/dpnp_utils_linalg.py @@ -449,6 +449,7 @@ def _batched_qr(a, mode="reduced"): a_t, shape=(batch_size, m, m), dtype=res_type, + order="C", ) else: mc = k @@ -456,6 +457,7 @@ def _batched_qr(a, mode="reduced"): a_t, shape=(batch_size, n, m), dtype=res_type, + order="C", ) # use DPCTL tensor function to fill the matrix array `q[..., :n, :]` @@ -2532,6 +2534,7 @@ def dpnp_qr(a, mode="reduced"): a_t, shape=(m, m), dtype=res_type, + order="C", ) else: mc = k @@ -2539,6 +2542,7 @@ def dpnp_qr(a, mode="reduced"): a_t, shape=(n, m), dtype=res_type, + order="C", ) # use DPCTL tensor function to fill the matrix array `q[:n]` From 7b2e77b0782a94f375847dad97c0ec899ebbf466 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Thu, 13 Feb 2025 08:30:10 -0800 Subject: [PATCH 2/2] Add test cases when n=1 --- dpnp/tests/test_linalg.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/dpnp/tests/test_linalg.py b/dpnp/tests/test_linalg.py index d67e859c2675..7622f93cad30 100644 --- a/dpnp/tests/test_linalg.py +++ b/dpnp/tests/test_linalg.py @@ -2369,12 +2369,24 @@ class TestQr: @pytest.mark.parametrize("dtype", get_all_dtypes(no_bool=True)) @pytest.mark.parametrize( "shape", - [(2, 2), (3, 4), (5, 3), (16, 16), (2, 2, 2), (2, 4, 2), (2, 2, 4)], + [ + (2, 1), + (2, 2), + (3, 4), + (5, 3), + (16, 16), + (3, 3, 1), + (2, 2, 2), + (2, 4, 2), + (2, 2, 4), + ], ids=[ + "(2, 1)", "(2, 2)", "(3, 4)", "(5, 3)", "(16, 16)", + "(3, 3, 1)", "(2, 2, 2)", "(2, 4, 2)", "(2, 2, 4)",