@@ -144,10 +144,39 @@ MATRIX_GROUPS[GROUP_BUILTIN] = Set([
144
144
])
145
145
MATRIX_GROUPS[GROUP_USER] = Set ([])
146
146
147
- # group functions
147
+ """
148
+ list_groups()
149
+
150
+ List all matrix groups.
151
+
152
+ # Examples
153
+ ```jldoctest
154
+ julia> list_groups()
155
+ 2-element Vector{Group}:
156
+ Group(:builtin)
157
+ Group(:user)
158
+ ```
159
+ """
148
160
list_groups () = collect (keys (MATRIX_GROUPS))
149
161
150
- # add to groups
162
+ """
163
+ add_to_groups(type, groups)
164
+
165
+ Add a matrix type to groups.
166
+
167
+ groups can be vector/varargs of `Group` or symbol.
168
+
169
+ # Examples
170
+ ```jldoctest
171
+ julia> add_to_groups(Tridiagonal, [Group(:user), Group(:test)])
172
+
173
+ julia> add_to_groups(Tridiagonal, Group(:user), Group(:test))
174
+
175
+ julia> add_to_groups(Tridiagonal, [:user, :test])
176
+
177
+ julia> add_to_groups(Tridiagonal, :user, :test)
178
+ ```
179
+ """
151
180
function add_to_groups (type:: Type{<:AbstractMatrix} , groups:: Vector{Group} )
152
181
for group = groups
153
182
# check group is builtin
@@ -169,7 +198,20 @@ add_to_groups(type::Type{<:AbstractMatrix}, groups::Group...) = add_to_groups(ty
169
198
add_to_groups (type:: Type{<:AbstractMatrix} , groups:: Symbol... ) = add_to_groups (type, collect (groups))
170
199
add_to_groups (type:: Type{<:AbstractMatrix} , groups:: Vector{Symbol} ) = add_to_groups (type, [Group (group) for group = groups])
171
200
172
- # remove from group
201
+ """
202
+ remove_from_group(type, group)
203
+
204
+ Remove a matrix type from a group.
205
+
206
+ See also [`remove_from_all_groups`](@ref).
207
+
208
+ # Examples
209
+ ```jldoctest
210
+ julia> remove_from_group(Tridiagonal, Group(:user))
211
+
212
+ julia> remove_from_group(Tridiagonal, :user)
213
+ ```
214
+ """
173
215
function remove_from_group (type:: Type{<:AbstractMatrix} , group:: Group )
174
216
# check group is not builtin
175
217
if group == GROUP_BUILTIN
198
240
# remove from group alternative interfaces
199
241
remove_from_group (type:: Type{<:AbstractMatrix} , group:: Symbol ) = remove_from_group (type, Group (group))
200
242
201
- # remove from all groups
243
+ """
244
+ remove_from_all_groups(type)
245
+
246
+ Remove a matrix type from all groups.
247
+
248
+ See also [`remove_from_group`](@ref).
249
+
250
+ # Examples
251
+ ```jldoctest
252
+ julia> remove_from_all_groups(Tridiagonal)
253
+ ```
254
+ """
202
255
function remove_from_all_groups (type:: Type{<:AbstractMatrix} )
203
256
for group = keys (MATRIX_GROUPS)
204
257
if group != GROUP_BUILTIN && type ∈ MATRIX_GROUPS[group]
@@ -207,7 +260,59 @@ function remove_from_all_groups(type::Type{<:AbstractMatrix})
207
260
end
208
261
end
209
262
210
- # list matrices
263
+ """
264
+ list_matrices(groups, props)
265
+
266
+ List all matrices that are in groups and have properties.
267
+
268
+ groups can be vector/varargs of `Group` or symbol.
269
+
270
+ props can be vector/varargs of `Property`, symbol, data type or property type.
271
+
272
+ # Examples
273
+ ```jldoctest
274
+ julia> list_matrices()
275
+ 42-element Vector{Type{<:AbstractMatrix}}:
276
+ Fiedler
277
+ Prolate
278
+ RandSVD
279
+ DingDong
280
+ Hankel
281
+ Companion
282
+ KMS
283
+ Moler
284
+ ⋮
285
+ Involutory
286
+ Sampling
287
+ Lotkin
288
+ Grcar
289
+ Triw
290
+ Hilbert
291
+ Pascal
292
+
293
+ julia> list_matrices([Group(:builtin), Group(:user)], [Property(:symmetric), Property(:inverse)])
294
+
295
+ julia> list_matrices(Property(:symmetric), Property(:inverse))
296
+
297
+ julia> list_matrices([Property(:symmetric), Property(:inverse)])
298
+
299
+ julia> list_matrices(:symmetric, :inverse)
300
+
301
+ julia> list_matrices([:symmetric, :inverse])
302
+
303
+ julia> list_matrices(PropertyTypes.Symmetric, PropertyTypes.Inverse)
304
+
305
+ julia> list_matrices([PropertyTypes.Symmetric, PropertyTypes.Inverse])
306
+
307
+ julia> list_matrices(PropertyTypes.Symmetric(), PropertyTypes.Inverse())
308
+
309
+ julia> list_matrices([PropertyTypes.Symmetric(), PropertyTypes.Inverse()])
310
+
311
+ julia> list_matrices(Group(:builtin), Group(:user))
312
+
313
+ julia> list_matrices([Group(:builtin), Group(:user)])
314
+ ```
315
+ """
211
316
function list_matrices (groups:: Vector{Group} , props:: Vector{Property} )
212
317
# check properties
213
318
check_properties_exists (props... )
0 commit comments