|
2 | 2 |
|
3 | 3 | ## Installation
|
4 | 4 |
|
5 |
| -TypedMatrices.jl is a registered package in the Julia package registry. To install it, you can use the Julia package manager. From the Julia REPL, type `]` to enter the Pkg REPL mode and run: |
| 5 | +TypedMatrices.jl is a registered package in the Julia package registry. Use Julia's package manager to install it: |
6 | 6 |
|
7 | 7 | ```julia-repl
|
8 |
| -pkg> add Documenter |
| 8 | +pkg> add TypedMatrices |
| 9 | +``` |
| 10 | + |
| 11 | +## Usage |
| 12 | + |
| 13 | +Use the package: |
| 14 | + |
| 15 | +```@repl getting-started |
| 16 | +using TypedMatrices |
| 17 | +``` |
| 18 | + |
| 19 | +You can list all matrices available with [`list_matrices`](@ref): |
| 20 | + |
| 21 | +```@repl getting-started |
| 22 | +list_matrices() |
| 23 | +``` |
| 24 | + |
| 25 | +## Creating Matrices |
| 26 | + |
| 27 | +Each type of matrix has its own type and constructors. For example, to create a 5x5 [Hilbert](@ref) matrix: |
| 28 | + |
| 29 | +```@repl getting-started |
| 30 | +h = Hilbert(5) |
| 31 | +``` |
| 32 | + |
| 33 | +Most matrices can accept a type parameter to specify the element type. For example, to create a 5x5 Hilbert matrix with `Float64` elements: |
| 34 | + |
| 35 | +```@repl getting-started |
| 36 | +Hilbert{Float64}(5) |
| 37 | +``` |
| 38 | + |
| 39 | +Please check [Builtin Matrices](@ref) in [Reference](@ref) for all available builtin matrices. |
| 40 | + |
| 41 | +## Properties |
| 42 | + |
| 43 | +Matrix has properties like `symmetric`, `illcond`, and `posdef`. Function [`properties`](@ref) can be used to get the properties of a matrix: |
| 44 | + |
| 45 | +```@repl getting-started |
| 46 | +properties(Hilbert) |
| 47 | +``` |
| 48 | + |
| 49 | +You can also check properties of a matrix instance for convinience: |
| 50 | + |
| 51 | +```@repl getting-started |
| 52 | +properties(h) |
| 53 | +``` |
| 54 | + |
| 55 | +To view all available properties, use [`list_properties`](@ref): |
| 56 | + |
| 57 | +```@repl getting-started |
| 58 | +list_properties() |
| 59 | +``` |
| 60 | + |
| 61 | +## Grouping |
| 62 | + |
| 63 | +This package has a grouping feature to group matrices. All builtin matrices are in the `builtin` group, we also create a `user` group for user-defined matrices. You can list all groups with: |
| 64 | + |
| 65 | +```@repl getting-started |
| 66 | +list_groups() |
| 67 | +``` |
| 68 | + |
| 69 | +To add a matrix to groups and enable it to be listed by [`list_matrices`](@ref), use [`add_to_groups`](@ref): |
| 70 | + |
| 71 | +```@repl getting-started |
| 72 | +add_to_groups(Matrix, :user, :test) |
| 73 | +list_matrices(Group(:user)) |
| 74 | +``` |
| 75 | + |
| 76 | +We can also add builtin matrices to our own groups: |
| 77 | + |
| 78 | +```@repl getting-started |
| 79 | +add_to_groups(Hilbert, :test) |
| 80 | +list_matrices(Group(:test)) |
| 81 | +``` |
| 82 | + |
| 83 | +To remove a matrix from a group or all groups, use [`remove_from_group`](@ref) or [`remove_from_all_groups`](@ref). The empty group will automatically be removed: |
| 84 | + |
| 85 | +```@repl getting-started |
| 86 | +remove_from_group(Hilbert, :test) |
| 87 | +remove_from_all_groups(Matrix) |
| 88 | +list_groups() |
9 | 89 | ```
|
0 commit comments