1
+ """
2
+ GrB_Matrix_new(A, type, nrows, ncols)
3
+
4
+ Create a new matrix with specified domain and dimensions.
5
+ """
1
6
function GrB_Matrix_new (A:: GrB_Matrix , type:: GrB_Type , nrows:: T , ncols:: T ) where T <: GrB_Index
2
7
A_ptr = pointer_from_objref (A)
3
8
@@ -11,6 +16,11 @@ function GrB_Matrix_new(A::GrB_Matrix, type::GrB_Type, nrows::T, ncols::T) where
11
16
)
12
17
end
13
18
19
+ """
20
+ GrB_Matrix_build(C, I, J, X, nvals, dup)
21
+
22
+ Store elements from tuples into a vector.
23
+ """
14
24
function GrB_Matrix_build (C:: GrB_Matrix , I:: Vector{U} , J:: Vector{U} , X:: Vector{T} , nvals:: U , dup:: GrB_BinaryOp ) where {U <: GrB_Index , T <: valid_types }
15
25
I_ptr = pointer (I)
16
26
J_ptr = pointer (J)
@@ -26,6 +36,12 @@ function GrB_Matrix_build(C::GrB_Matrix, I::Vector{U}, J::Vector{U}, X::Vector{T
26
36
)
27
37
end
28
38
39
+ """
40
+ GrB_Matrix_nrows(A)
41
+
42
+ Return the number of rows in a matrix if successful.
43
+ Else return value of type GrB Info.
44
+ """
29
45
function GrB_Matrix_nrows (A:: GrB_Matrix )
30
46
nrows = Ref (UInt64 (0 ))
31
47
result = GrB_Info (
@@ -40,6 +56,12 @@ function GrB_Matrix_nrows(A::GrB_Matrix)
40
56
return _GrB_Index (nrows[])
41
57
end
42
58
59
+ """
60
+ GrB_Matrix_ncols(A)
61
+
62
+ Return the number of columns in a matrix if successful.
63
+ Else return value of type GrB Info.
64
+ """
43
65
function GrB_Matrix_ncols (A:: GrB_Matrix )
44
66
ncols = Ref (UInt64 (0 ))
45
67
result = GrB_Info (
@@ -54,6 +76,12 @@ function GrB_Matrix_ncols(A::GrB_Matrix)
54
76
return _GrB_Index (ncols[])
55
77
end
56
78
79
+ """
80
+ GrB_Matrix_nvals(A)
81
+
82
+ Return the number of stored elements in a matrix if successful.
83
+ Else return value of type GrB Info.
84
+ """
57
85
function GrB_Matrix_nvals (A:: GrB_Matrix )
58
86
nvals = Ref (UInt64 (0 ))
59
87
result = GrB_Info (
@@ -68,6 +96,11 @@ function GrB_Matrix_nvals(A::GrB_Matrix)
68
96
return _GrB_Index (nvals[])
69
97
end
70
98
99
+ """
100
+ GrB_Matrix_dup(C, A)
101
+
102
+ Create a new matrix with the same domain, dimensions, and contents as another matrix.
103
+ """
71
104
function GrB_Matrix_dup (C:: GrB_Matrix , A:: GrB_Matrix )
72
105
C_ptr = pointer_from_objref (C)
73
106
@@ -81,6 +114,11 @@ function GrB_Matrix_dup(C::GrB_Matrix, A::GrB_Matrix)
81
114
)
82
115
end
83
116
117
+ """
118
+ GrB_Matrix_clear(A)
119
+
120
+ Remove all elements from a matrix.
121
+ """
84
122
function GrB_Matrix_clear (A:: GrB_Matrix )
85
123
return GrB_Info (
86
124
ccall (
@@ -92,6 +130,11 @@ function GrB_Matrix_clear(A::GrB_Matrix)
92
130
)
93
131
end
94
132
133
+ """
134
+ GrB_Matrix_setElement(C, X, I, J)
135
+
136
+ Set one element of a matrix to a given value, C[I][J] = X.
137
+ """
95
138
function GrB_Matrix_setElement (C:: GrB_Matrix , X:: T , I:: U , J:: U ) where {U <: GrB_Index , T <: valid_int_types }
96
139
fn_name = " GrB_Matrix_setElement_" * get_suffix (T)
97
140
return GrB_Info (
@@ -128,6 +171,12 @@ function GrB_Matrix_setElement(C::GrB_Matrix, X::Float64, I::U, J::U) where U <:
128
171
)
129
172
end
130
173
174
+ """
175
+ GrB_Matrix_extractElement(A, row_index, col_index)
176
+
177
+ Return element of a vector at a given index (A[row_index][col_index]) if successful.
178
+ Else return value of type GrB Info.
179
+ """
131
180
function GrB_Matrix_extractElement (A:: GrB_Matrix , row_index:: U , col_index:: U ) where U <: GrB_Index
132
181
res, A_type = GxB_Matrix_type (A)
133
182
res != GrB_SUCCESS && return res
@@ -147,6 +196,11 @@ function GrB_Matrix_extractElement(A::GrB_Matrix, row_index::U, col_index::U) wh
147
196
return element[]
148
197
end
149
198
199
+ """
200
+ GrB_Matrix_extractTuples(A)
201
+
202
+ Return tuples stored in a matrix.
203
+ """
150
204
function GrB_Matrix_extractTuples (A:: GrB_Matrix )
151
205
res, A_type = GxB_Matrix_type (A)
152
206
res != GrB_SUCCESS && return res
0 commit comments