@@ -114,7 +114,12 @@ function ==(A::GrB_Matrix{T}, B::GrB_Matrix{U}) where {T, U}
114114 C = GrB_Matrix (Bool, Asize... )
115115 op = equal_op (T)
116116
117- GrB_eWiseMult (C, GrB_NULL, GrB_NULL, op, A, B, GrB_NULL)
117+ res = GrB_eWiseMult (C, GrB_NULL, GrB_NULL, op, A, B, GrB_NULL)
118+
119+ if res != GrB_SUCCESS
120+ GrB_free (C)
121+ error (res)
122+ end
118123
119124 if nnz (C) != Anvals
120125 GrB_free (C)
@@ -125,6 +130,10 @@ function ==(A::GrB_Matrix{T}, B::GrB_Matrix{U}) where {T, U}
125130
126131 GrB_free (C)
127132
133+ if typeof (result) == GrB_Info
134+ error (result)
135+ end
136+
128137 return result
129138end
130139
@@ -364,6 +373,34 @@ function copy(A::GrB_Matrix{T}) where T <: valid_types
364373 return C
365374end
366375
376+ """
377+ adjoint(A)
378+
379+ Compute transpose of a GraphBLAS matrix.
380+
381+ # Examples
382+ ```jldoctest
383+ julia> using SuiteSparseGraphBLAS
384+
385+ julia> GrB_init(GrB_NONBLOCKING)
386+ GrB_SUCCESS::GrB_Info = 0
387+
388+ julia> M = GrB_Matrix([1, 1], [2, 3], [1, 1])
389+ GrB_Matrix{Int64}
390+
391+ julia> findnz(M')
392+ ([2, 3], [1, 1], [1, 1])
393+ ```
394+ """
395+ function adjoint (A:: GrB_Matrix{T} ) where T <: valid_types
396+ C = GrB_Matrix (T, size (A, 2 ), size (A, 1 ))
397+ res = GrB_transpose (C, GrB_NULL, GrB_NULL, A, GrB_NULL)
398+ if res != GrB_SUCCESS
399+ error (res)
400+ end
401+ return C
402+ end
403+
367404"""
368405 LowerTriangular(A)
369406
@@ -375,7 +412,10 @@ function LowerTriangular(A::GrB_Matrix{T}) where T <: valid_types
375412 error (" Matrix is not square" )
376413 end
377414 L = GrB_Matrix (T, nrows, ncols)
378- GxB_select (L, GrB_NULL, GrB_NULL, GxB_TRIL, A, 0 , GrB_NULL)
415+ res = GxB_select (L, GrB_NULL, GrB_NULL, GxB_TRIL, A, 0 , GrB_NULL)
416+ if res != GrB_SUCCESS
417+ error (res)
418+ end
379419 return L
380420end
381421
@@ -390,7 +430,10 @@ function UpperTriangular(A::GrB_Matrix{T}) where T <: valid_types
390430 error (" Matrix is not square" )
391431 end
392432 U = GrB_Matrix (T, nrows, ncols)
393- GxB_select (U, GrB_NULL, GrB_NULL, GxB_TRIU, A, 0 , GrB_NULL)
433+ res = GxB_select (U, GrB_NULL, GrB_NULL, GxB_TRIU, A, 0 , GrB_NULL)
434+ if res != GrB_SUCCESS
435+ error (res)
436+ end
394437 return U
395438end
396439
@@ -402,6 +445,9 @@ Return diagonal of a GraphBLAS matrix.
402445function Diagonal (A:: GrB_Matrix{T} ) where T <: valid_types
403446 nrows, ncols = size (A)
404447 D = GrB_Matrix (T, nrows, ncols)
405- GxB_select (D, GrB_NULL, GrB_NULL, GxB_DIAG, A, 0 , GrB_NULL)
448+ res = GxB_select (D, GrB_NULL, GrB_NULL, GxB_DIAG, A, 0 , GrB_NULL)
449+ if res != GrB_SUCCESS
450+ error (res)
451+ end
406452 return D
407453end
0 commit comments