Skip to content

Commit 74043c3

Browse files
committed
Flags fnc to 'F-not-C' and added fc ('F-and-C')
1 parent 5deed9b commit 74043c3

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

dpctl/tensor/_flags.pyx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ cdef class Flags:
5757
def writable(self):
5858
return _check_bit(self.flags_, USM_ARRAY_WRITEABLE)
5959

60+
@property
61+
def fc(self):
62+
return (
63+
_check_bit(self.flags_, USM_ARRAY_C_CONTIGUOUS)
64+
and _check_bit(self.flags_, USM_ARRAY_F_CONTIGUOUS)
65+
)
66+
6067
@property
6168
def forc(self):
6269
return (
@@ -68,7 +75,7 @@ cdef class Flags:
6875
def fnc(self):
6976
return (
7077
_check_bit(self.flags_, USM_ARRAY_C_CONTIGUOUS)
71-
and _check_bit(self.flags_, USM_ARRAY_F_CONTIGUOUS)
78+
and not _check_bit(self.flags_, USM_ARRAY_F_CONTIGUOUS)
7279
)
7380

7481
@property
@@ -82,6 +89,8 @@ cdef class Flags:
8289
return self.f_contiguous
8390
elif name == "WRITABLE":
8491
return self.writable
92+
elif name == "FC":
93+
return self.fc
8594
elif name == "CONTIGUOUS":
8695
return self.forc
8796

dpctl/tests/test_usm_ndarray_ctor.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ def test_allocate_usm_ndarray(shape, usm_type):
5959

6060

6161
def test_usm_ndarray_flags():
62-
assert dpt.usm_ndarray((5,)).flags.fnc
62+
assert dpt.usm_ndarray((5,)).flags.fc
6363
assert dpt.usm_ndarray((5, 2)).flags.c_contiguous
6464
assert dpt.usm_ndarray((5, 2), order="F").flags.f_contiguous
6565
assert dpt.usm_ndarray((5, 1, 2), order="F").flags.f_contiguous
6666
assert dpt.usm_ndarray((5, 1, 2), strides=(2, 0, 1)).flags.c_contiguous
6767
assert dpt.usm_ndarray((5, 1, 2), strides=(1, 0, 5)).flags.f_contiguous
68-
assert dpt.usm_ndarray((5, 1, 1), strides=(1, 0, 1)).flags.fnc
68+
assert dpt.usm_ndarray((5, 1, 1), strides=(1, 0, 1)).flags.fc
6969

7070

7171
@pytest.mark.parametrize(
@@ -1525,6 +1525,7 @@ def test_flags():
15251525
f.c_contiguous
15261526
f.f_contiguous
15271527
f.contiguous
1528+
f.fc
15281529
f.fnc
15291530
f.forc
15301531
f.writable

0 commit comments

Comments
 (0)