File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import ctypes
22
3-
43__all__ = [
54 "CuBoolInstanceDesc" ,
65 "load_and_configure" ,
@@ -63,6 +62,11 @@ def load_and_configure(cubool_lib_path: str):
6362 ctypes .POINTER (ctypes .c_uint ),
6463 ctypes .POINTER (ctypes .c_size_t )]
6564
65+ lib .CuBool_Matrix_Duplicate .restype = ctypes .c_uint
66+ lib .CuBool_Matrix_Duplicate .argtypes = [instance_p ,
67+ matrix_p ,
68+ p_to_matrix_p ]
69+
6670 lib .CuBool_Matrix_Nrows .restype = ctypes .c_uint
6771 lib .CuBool_Matrix_Nrows .argtype = [instance_p ,
6872 matrix_p ,
@@ -83,6 +87,18 @@ def load_and_configure(cubool_lib_path: str):
8387 matrix_p ,
8488 matrix_p ]
8589
90+ lib .CuBool_MxM .restype = ctypes .c_uint
91+ lib .CuBool_MxM .argtypes = [instance_p ,
92+ matrix_p ,
93+ matrix_p ,
94+ matrix_p ]
95+
96+ lib .CuBool_Kron .restype = ctypes .c_uint
97+ lib .CuBool_Kron .argtypes = [instance_p ,
98+ matrix_p ,
99+ matrix_p ,
100+ matrix_p ]
101+
86102 return lib
87103
88104
Original file line number Diff line number Diff line change 1+ from . import wrapper
2+ from . import dll
3+ from . import matrix
4+
5+ __all__ = [
6+ "kron"
7+ ]
8+
9+
10+ def kron (result_matrix : matrix .Matrix , a_matrix : matrix .Matrix , b_matrix : matrix .Matrix ):
11+ status = wrapper .loaded_dll .CuBool_Kron (wrapper .instance ,
12+ result_matrix .hnd ,
13+ a_matrix .hnd ,
14+ b_matrix .hnd )
15+
16+ dll .check (status )
Original file line number Diff line number Diff line change 33from . import wrapper
44from . import dll
55
6-
76__all__ = [
87 "Matrix"
98]
@@ -63,7 +62,7 @@ def nrows(self) -> int:
6362 return int (result .value )
6463
6564 @property
66- def nclos (self ):
65+ def nclos (self ) -> int :
6766 result = ctypes .c_uint (0 )
6867
6968 status = wrapper .loaded_dll .CuBool_Matrix_Ncols (wrapper .instance ,
@@ -103,3 +102,12 @@ def to_lists(self):
103102 dll .check (status )
104103
105104 return rows , cols
105+
106+ def duplicate (self ):
107+ result_matrix = Matrix (self .nrows , self .nclos )
108+ status = wrapper .loaded_dll .CuBool_Matrix_Duplicate (wrapper .instance ,
109+ self .hnd ,
110+ result_matrix .hnd )
111+
112+ dll .check (status )
113+ return result_matrix
Original file line number Diff line number Diff line change 1+ from . import wrapper
2+ from . import dll
3+ from . import matrix
4+
5+ __all__ = [
6+ "mxm"
7+ ]
8+
9+
10+ def mxm (result_matrix : matrix .Matrix , a_matrix : matrix .Matrix , b_matrix : matrix .Matrix ):
11+ status = wrapper .loaded_dll .CuBool_MxM (wrapper .instance ,
12+ result_matrix .hnd ,
13+ a_matrix .hnd ,
14+ b_matrix .hnd )
15+
16+ dll .check (status )
You can’t perform that action at this time.
0 commit comments