File tree Expand file tree Collapse file tree 4 files changed +59
-3
lines changed Expand file tree Collapse file tree 4 files changed +59
-3
lines changed Original file line number Diff line number Diff line change 1
1
import ctypes
2
2
3
-
4
3
__all__ = [
5
4
"CuBoolInstanceDesc" ,
6
5
"load_and_configure" ,
@@ -63,6 +62,11 @@ def load_and_configure(cubool_lib_path: str):
63
62
ctypes .POINTER (ctypes .c_uint ),
64
63
ctypes .POINTER (ctypes .c_size_t )]
65
64
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
+
66
70
lib .CuBool_Matrix_Nrows .restype = ctypes .c_uint
67
71
lib .CuBool_Matrix_Nrows .argtype = [instance_p ,
68
72
matrix_p ,
@@ -83,6 +87,18 @@ def load_and_configure(cubool_lib_path: str):
83
87
matrix_p ,
84
88
matrix_p ]
85
89
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
+
86
102
return lib
87
103
88
104
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 3
3
from . import wrapper
4
4
from . import dll
5
5
6
-
7
6
__all__ = [
8
7
"Matrix"
9
8
]
@@ -63,7 +62,7 @@ def nrows(self) -> int:
63
62
return int (result .value )
64
63
65
64
@property
66
- def nclos (self ):
65
+ def nclos (self ) -> int :
67
66
result = ctypes .c_uint (0 )
68
67
69
68
status = wrapper .loaded_dll .CuBool_Matrix_Ncols (wrapper .instance ,
@@ -103,3 +102,12 @@ def to_lists(self):
103
102
dll .check (status )
104
103
105
104
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