Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
53c4e55
start of developer documents file
nathanielpritchard Feb 10, 2025
f82346b
correct issue in make file
nathanielpritchard Feb 10, 2025
95b0cd8
checklist
Tuna2222 Jun 25, 2025
64760f1
Checklist saperation
Tuna2222 Jul 2, 2025
1633503
dev
Tuna2222 Jul 2, 2025
c6de884
small changes
Tuna2222 Jul 23, 2025
f7a284f
yml
Tuna2222 Aug 6, 2025
0d10ada
docs
Tuna2222 Aug 13, 2025
1d5ac70
123
Tuna2222 Aug 13, 2025
ffba348
initialized the introduction
nathanielpritchard Aug 23, 2025
2c54d6a
slight intro edits
nathanielpritchard Aug 24, 2025
ff88338
removed redundant key function sec
nathanielpritchard Aug 24, 2025
6708ae9
rewrite in html
Tuna2222 Aug 24, 2025
63a9479
Add md with no Julia light
Tuna2222 Aug 24, 2025
c557f17
Only left the version with HTML and comment out others
Tuna2222 Aug 27, 2025
25f4099
123
Tuna2222 Sep 24, 2025
7c3fb87
merge
Tuna2222 Sep 24, 2025
7b0534d
Merge branch 'main' into v0.2-dev_docs
Tuna2222 Sep 24, 2025
6226f6b
merge main
Tuna2222 Sep 24, 2025
e83a636
0.24
Tuna2222 Sep 24, 2025
e5b94a9
docs/getting_started.md changes
Tuna2222 Oct 1, 2025
99fa32a
comment out CI.yml
Tuna2222 Oct 1, 2025
bba815a
delete md
Tuna2222 Oct 1, 2025
b6760bd
Merge branch 'main' into v0.2-tutorials
Tuna2222 Oct 1, 2025
0827c79
delete CI
Tuna2222 Oct 8, 2025
ff201f0
pr template
Tuna2222 Oct 8, 2025
43bec29
Update docs/src/tutorials/getting_started.md
Tuna2222 Oct 8, 2025
3198fad
Update docs/src/dev/style_guide.md
Tuna2222 Oct 8, 2025
c6caee7
Update docs/src/manual/introduction.md
Tuna2222 Oct 8, 2025
45f413f
Update docs/src/tutorials/getting_started.md
Tuna2222 Oct 8, 2025
2b5de08
docs/make pr non-overlap
Tuna2222 Oct 8, 2025
80129e4
Merge branch 'v0.2-tutorials' of https://github.com/numlinalg/RLinear…
Tuna2222 Oct 8, 2025
34c0dcc
docs/refine LS example
Tuna2222 Oct 8, 2025
1909a3e
docs/tutorials/intro
Tuna2222 Oct 8, 2025
80aeb6b
docs/purify the branch
Tuna2222 Oct 15, 2025
c79ffec
Merge branch 'main' into v0.2-tutorials
Tuna2222 Oct 15, 2025
c359f9d
docs/reformulate
Tuna2222 Oct 15, 2025
20fea52
docs/reformulate
Tuna2222 Oct 15, 2025
8c51331
docs/reformulate
Tuna2222 Oct 15, 2025
543f3e5
docs/reformulate
Tuna2222 Oct 16, 2025
8863bcb
docs/tutorial
Tuna2222 Oct 22, 2025
569da4e
Merge branch 'main' into v0.2-tutorials
Tuna2222 Oct 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions .github/workflows/Documenter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@ name: Documenter
on:
push:
branches:
- master
- main
- v0.2-main
tags: '*'
tags:
- 'v*'
pull_request:
branches:
- master
- main
- v0.2-main
jobs:
build:
runs-on: ubuntu-latest
Expand Down
14 changes: 7 additions & 7 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@ bib = CitationBibliography(
)
makedocs(
sitename = "RLinearAlgebra",
format = Documenter.HTML(
collapselevel=1,
),
plugins=[bib],
modules = [RLinearAlgebra],
pages = [
"Home" => "index.md",
# "Tutorials" => [
# "Introduction" => "tutorials/introduction.md",
# "Getting started" => "tutorials/getting_started.md"
# ],
"Tutorials" => [
"Introduction" => "tutorials/introduction.md",
"Consistent Linear System" => [
"tutorials/consistent_system/consistent_system.md",
"tutorials/consistent_system/consistent_system_compressor.md",
],
"Manual" => [
"Introduction" => "manual/introduction.md",
"Compression" => "manual/compression.md",
Expand All @@ -40,6 +39,7 @@ makedocs(
],
],
"References" => "references.md",
],
]
)

Expand Down
143 changes: 143 additions & 0 deletions docs/src/tutorials/consistent_system/consistent_system.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
# Solving a Consistent Linear System

This guide demonstrates how to use `RLinearAlgebra.jl` package to solve a
**consistent linear system**—a system where at least one solution
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- --> ---

exists—expressed in the form:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

---> ---


$$Ax = b$$
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a punctuation mark at the end of the equation.


We'll walk through setting up the problem, using a solver, and verifying the result.

---
## Problem setup and solve the system
Comment on lines +11 to +12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this


First, let's define our linear system $Ax = b$.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
First, let's define our linear system $Ax = b$.
First, let's define our linear system $Ax = b$ with some known solution `x_true`.


To easily verify the accuracy of our solver, we'll construct a problem where the true
solution, $x_{\text{true}}$, is known beforehand. We'll start by creating a random
matrix $A$ and a known solution vector $x_{\text{true}}$. Then, we can generate the
right-hand side vector $b$ by computing $b = Ax_{\text{true}}$.

The following Julia code imports the necessary libraries, sets up the dimensions, and
creates $A$, $x_{\text{true}}$, and $b$. We also initialize a starting guess, `x_init`,
for our iterative solver.

Comment on lines +15 to +24
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove this.

```julia
using LinearAlgebra
num_rows, num_cols = 1000, 20;
A = randn(Float64, num_rows, num_cols);
x_true = randn(Float64, num_cols);
x_init = zeros(Float64, num_cols);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove this line as it is not relevant to problem setup.

b = A * x_true;
```

```@setup ConsistentExample
using LinearAlgebra
num_rows, num_cols = 1000, 20;
A = randn(Float64, num_rows, num_cols);
x_true = randn(Float64, num_cols);
x_init = zeros(Float64, num_cols);
b = A * x_true;
```

As simple as you can imagine, `RLinearAlgebra.jl` can solve this system in just a
few lines of codes and high efficiency:
Comment on lines +43 to +44
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
As simple as you can imagine, `RLinearAlgebra.jl` can solve this system in just a
few lines of codes and high efficiency:
`RLinearAlgebra.jl` can solve this system in just a few lines of codes:


```@example ConsistentExample
using RLinearAlgebra
logger = BasicLogger(max_it = 300)
kaczmarz_solver = Kaczmarz(log = logger)
Comment on lines +48 to +49
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
logger = BasicLogger(max_it = 300)
kaczmarz_solver = Kaczmarz(log = logger)
solver = Kaczmarz(log = BasicLogger(max_it = 300))

solver_recipe = complete_solver(kaczmarz_solver, x_init, A, b)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
solver_recipe = complete_solver(kaczmarz_solver, x_init, A, b)
solution = zeros(Float64, num_cols)

rsolve!(solver_recipe, x_init, A, b)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
rsolve!(solver_recipe, x_init, A, b)
rsolve!(solver, solution, A, b)


solution = x_init;
println("Solution to the system: \n", solution)
Comment on lines +52 to +54
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove these

```
**Done! How simple it is!**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"rsolve! puts the solution in the vector solution.



Let's check how close our calculated `solution` is to the known `x_true`.
We can measure the accuracy by calculating the Euclidean norm of the difference
between the two vectors. A small norm indicates that our solver found a good approximation.

```@example ConsistentExample
# Calculate the norm of the error
error_norm = norm(solution - x_true)
println(" - Norm of the error between the solution and x_true: ", error_norm)
```
As you can see, by using the modular Kaczmarz solver, we were able to configure a
randomized block-based method and find a solution vector that is very close to
the true solution.


Let's break down the solver code line by line to understand what each part does.

---
## Codes breakdown

As shown in the code, we used the [`Kaczmarz` solver](@ref Kaczmarz). A key feature of
**RLinearAlgebra.jl** is its modularity; you can customize the solver's behavior by passing
in different "component" objects for tasks, such as system compression, progress logging,
and termination checks.

For this example, we kept it simple by only customizing the maximum iteration located
in [`Logger`](@ref Logger) component. Let's break down each step.


### Configure the logger

We start with the simplest component: the [`Logger`](@ref Logger). The
[`Logger`](@ref Logger) is
responsible for tracking metrics (such as the error history) and telling the solver
when to stop. For this guide, we use the default [`BasicLogger`](@ref BasicLogger)
and configure
it with a single stopping criterion: a maximum number of iterations.

```julia
# Configure the maximum iteration to be 300
logger = BasicLogger(max_it = 300)
```

### Create the solver

Before running the solver on our specific problem (`A, b, x_init`), we must prepare it
using the [`complete_solver`](@ref complete_solver) function. This function creates
a [`KaczmarzRecipe`](@ref KaczmarzRecipe), which combines the solver
configuration with the problem data.

Crucially, this "recipe" pre-allocates all necessary memory buffers, which is a
key step for ensuring efficient and high-performance computation.

```julia
# Create the Kaczmarz solver object by passing in the ingredients
kaczmarz_solver = Kaczmarz(log = logger)
# Create the solver recipe by combining the solver and the problem data
solver_recipe = complete_solver(kaczmarz_solver, x_init, A, b)
```

### Solve the system using the solver

Finally, we call [`rsolve!`](@ref rsolve!) to execute the algorithm. The `!` at the end
of the function name is a Julia convention indicating that the function will inplace
update part of its arguments. In this case, `rsolve!` modifies `x_init` in-place,
filling it with the final solution vector. The solver will iterate until a stopping
criterion in the `logger` is met, i.e. iteration goes up to $300$.

```julia
# Run the inplace solver!
rsolve!(solver_recipe, x_init, A, b)

# The solution is now stored in the updated x_init vector
solution = x_init;
```
Comment on lines +59 to +132
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can go somewhere else.












Loading
Loading