@@ -38,6 +38,15 @@ function serialize_sizehint(A::GBVecOrMat)
38
38
return sz[]
39
39
end
40
40
41
+ """
42
+ gbwrite(filename::AbstractString, A::GBVecOrMat)
43
+ gbwrite(io::IO, A::GBVecOrMat)
44
+
45
+ Write `A` as a `GrB_Matrix` to a file or IO object. This function uses the
46
+ `GrB_Matrix_serialize` routine from the C GraphBLAS library, and *does not* serialize
47
+ the full Julia object. To read this serialized matrix you must use [`gbread`](@ref) with
48
+ a type or [`gbread_matrix`](@ref) / [`gbread_vector`](@ref) to use serialized element type.
49
+ """
41
50
gbwrite (filename:: AbstractString , A:: GBVecOrMat ) = open (io-> gbwrite (io, A), filename, " w" )
42
51
43
52
function gbwrite (io:: IO , A:: GBVecOrMat )
@@ -49,6 +58,14 @@ function gbwrite(io::IO, A::GBVecOrMat)
49
58
write (io, v)
50
59
end
51
60
61
+ """
62
+ gbread(filename::AbstractString, ::Type{GBMatrix{T, Tf}}; fill)
63
+ gbread(io::IO, ::Type{GBMatrix{T, Tf}}; fill)
64
+
65
+ Read a `GrB_Matrix` from a file or IO object. This function uses the
66
+ `GrB_Matrix_deserialize` routine from the C GraphBLAS library directly, and constructs the
67
+ passed in type. It does not use Julia's Serialization standard library.
68
+ """
52
69
gbread (filename:: AbstractString , :: Type{T} ; fill = defaultfill (Tf)) where {Te, Tf, T<: GBVecOrMat{Te, Tf} } =
53
70
open (io-> gbread (io, T; fill), filename, " r" )
54
71
@@ -64,6 +81,15 @@ function gbread(io::IO, ::Type{GBVector{T, Tf}}; fill = defaultfill(Tf)) where {
64
81
GBVector {T, Tf} (gb, fill)
65
82
end
66
83
84
+ """
85
+ gbread_matrix(filename::AbstractString; fill)
86
+ gbread_matrix(io::IO; fill)
87
+
88
+ Read a `GrB_Matrix` from a file or IO object. This function uses the
89
+ `GrB_Matrix_deserialize` routine from the C GraphBLAS library directly, and constructs
90
+ a [`GBMatrix`](@ref) using the deserialized element type. The default fill for the deserialized
91
+ element type is used unless one is passed in as the keyword argument `fill`.
92
+ """
67
93
gbread_matrix (filename:: AbstractString ; fill = Nothing) =
68
94
open (io-> gbread_matrix (io; fill), filename, " r" )
69
95
@@ -76,6 +102,17 @@ function gbread_matrix(io::IO; fill = Nothing)
76
102
fill = fill === Nothing ? defaultfill (T) : fill
77
103
return GBMatrix {T} (gb; fill)
78
104
end
105
+ """
106
+ gbread_matrix(filename::AbstractString; fill)
107
+ gbread_matrix(io::IO; fill)
108
+
109
+ Read a `GrB_Matrix` from a file or IO object. This function uses the
110
+ `GrB_Matrix_deserialize` routine from the C GraphBLAS library directly, and constructs
111
+ a [`GBMatrix`](@ref) using the deserialized element type. The default fill for the deserialized
112
+ element type is used unless one is passed in as the keyword argument `fill`.
113
+ """
114
+ gbread_vector (filename:: AbstractString ; fill = Nothing) =
115
+ open (io-> gbread_vector (io; fill), filename, " r" )
79
116
function gbread_vector (io:: IO ; fill = Nothing)
80
117
v = read (io)
81
118
gb = _gbdeserialize_matrix (v, Nothing) # we don't know the eltype pass nothing
0 commit comments