Skip to content

Commit c32c591

Browse files
add transpose operation
1 parent 6ad36bb commit c32c591

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

src/Operations/Transpose.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
function GrB_transpose( # C<Mask> = accum (C, A')
2+
C::GrB_Matrix, # input/output matrix for results
3+
Mask::T, # optional mask for C, unused if NULL
4+
accum::U, # optional accum for Z=accum(C,T)
5+
A::GrB_Matrix, # first input: matrix A
6+
desc::V # descriptor for C, Mask, and A
7+
) where {T <: valid_matrix_mask_types, U <: valid_accum_types, V <: valid_desc_types}
8+
9+
return GrB_Info(
10+
ccall(
11+
dlsym(graphblas_lib, "GrB_transpose"),
12+
Cint,
13+
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}),
14+
C.p, Mask.p, accum.p, A.p, desc.p
15+
)
16+
)
17+
end

src/SuiteSparseGraphBLAS.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ include("Operations/Element_wise_addition.jl")
148148
include("Operations/Extract.jl")
149149
include("Operations/Apply.jl")
150150
include("Operations/Reduce.jl")
151+
include("Operations/Transpose.jl")
151152

152153
export
153154
# Context Methods
@@ -191,11 +192,14 @@ GrB_eWiseAdd,
191192
GrB_Vector_extract, GrB_Matrix_extract, GrB_Col_extract,
192193

193194
# Apply
194-
GrB_apply, GrB_Vector_apply, GrB_Matrix_apply
195+
GrB_apply, GrB_Vector_apply, GrB_Matrix_apply,
195196

196197
# Reduce
197198
GrB_Matrix_reduce_Monoid, GrB_Matrix_reduce_BinaryOp, GrB_Matrix_reduce,
198-
GrB_Vector_reduce
199+
GrB_Vector_reduce,
200+
201+
# Transpose
202+
GrB_transpose
199203

200204
# Export global variables
201205

0 commit comments

Comments
 (0)