Skip to content

Commit 0e8320e

Browse files
committed
new docstrings
1 parent aad7ebe commit 0e8320e

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

src/interfaces.jl

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ export solve
1818
* "configs max2", all MIS configurations and MIS-1 configurations,
1919
* "configs all", all IS configurations,
2020
* "configs max (bounded)", all MIS configurations, the bounded approach (much faster),
21+
* "configs max2 (bounded)", all MIS and MIS-1 configurations, the bounded approach (much faster),
22+
* "configs max3 (bounded)", all MIS, MIS-1 and MIS-2 configurations, the bounded approach (much faster),
2123
"""
2224
function solve(gp::GraphProblem, task; usecuda=false, kwargs...)
2325
if task == "size max"
@@ -62,6 +64,12 @@ end
6264

6365
export save_configs, load_configs
6466
using DelimitedFiles
67+
68+
"""
69+
save_configs(filename, data::ConfigEnumerator; format=:binary)
70+
71+
Save configurations `data` to file `filename`. The format is `:binary` or `:text`.
72+
"""
6573
function save_configs(filename, data::ConfigEnumerator{N,S,C}; format::Symbol=:binary) where {N,S,C}
6674
if format == :binary
6775
write(filename, raw_matrix(data))
@@ -71,12 +79,20 @@ function save_configs(filename, data::ConfigEnumerator{N,S,C}; format::Symbol=:b
7179
error("format must be `:binary` or `:text`, got `:$format`")
7280
end
7381
end
74-
function load_configs(filename; len=nothing, format::Symbol=:binary, nflavors=2)
82+
83+
"""
84+
load_configs(filename; format=:binary, bitlength=nothing, nflavors=2)
85+
86+
Load configurations from file `filename`. The format is `:binary` or `:text`.
87+
If the format is `:binary`, the bitstring length `bitlength` must be specified,
88+
`nflavors` specifies the degree of freedom.
89+
"""
90+
function load_configs(filename; bitlength=nothing, format::Symbol=:binary, nflavors=2)
7591
if format == :binary
76-
len === nothing && error("you need to specify `len` for reading configurations from binary files.")
92+
bitlength === nothing && error("you need to specify `bitlength` for reading configurations from binary files.")
7793
S = ceil(Int, log2(nflavors))
78-
C = _nints(len, S)
79-
return _from_raw_matrix(StaticElementVector{len,S,C}, reshape(reinterpret(UInt64, read(filename)),C,:))
94+
C = _nints(bitlength, S)
95+
return _from_raw_matrix(StaticElementVector{bitlength,S,C}, reshape(reinterpret(UInt64, read(filename)),C,:))
8096
elseif format == :text
8197
return from_plain_matrix(readdlm(filename); nflavors=nflavors)
8298
else

0 commit comments

Comments
 (0)