From 70418c41b9a3d2f89649edc421d5b6b45f9c1516 Mon Sep 17 00:00:00 2001 From: James Schloss Date: Mon, 29 Nov 2021 14:12:36 +0100 Subject: [PATCH 1/2] updating all masters to main --- .github/workflows/deploy.yml | 2 +- .github/workflows/publish_container.yml | 8 +- .gitignore | 3 + .travis.yml | 29 -- contents/IFS/IFS.md | 2 +- .../affine_transformations.md | 2 +- .../approximate_counting.md | 2 +- .../backward_euler_method.md | 2 +- .../barnes_hut_algorithm.md | 2 +- contents/barnsley/barnsley.md | 2 +- contents/bitlogic/bitlogic.md | 2 +- contents/cc/license.txt | 2 +- contents/chans_algorithm/chans_algorithm.md | 2 +- .../choosing_a_language.md | 2 +- .../compiled_languages/compiled_languages.md | 2 +- .../computational_geometry.md | 2 +- contents/computus/computus.md | 2 +- contents/convolutions/1d/1d.md | 2 +- contents/convolutions/2d/2d.md | 2 +- .../convolutional_theorem.md | 2 +- contents/cooley_tukey/cooley_tukey.md | 2 +- contents/data_compression/data_compression.md | 2 +- contents/data_structures/data_structures.md | 2 +- .../decision_problems/decision_problems.md | 2 +- .../differential_equations.md | 2 +- contents/domain_coloring/domain_coloring.md | 2 +- .../domain_coloring/domain_coloring.md.bak | 185 ------------- .../euclidean_algorithm.md | 2 +- contents/flood_fill/flood_fill.md | 2 +- contents/flood_fill/flood_fill.md.bak | 258 ------------------ contents/fortran/fortran.md | 2 +- .../forward_euler_method.md | 2 +- .../gaussian_elimination.md | 2 +- contents/gift_wrapping/gift_wrapping.md | 2 +- contents/graham_scan/graham_scan.md | 2 +- .../how_to_contribute/how_to_contribute.md | 2 +- contents/huffman_encoding/huffman_encoding.md | 2 +- contents/introduction/introduction.md | 2 +- contents/jarvis_march/jarvis_march.md | 2 +- contents/makefiles/makefiles.md | 2 +- .../mathematical_background.md | 2 +- contents/matrix_methods/matrix_methods.md | 2 +- .../monte_carlo_integration.md | 2 +- contents/multiplication/multiplication.md | 2 +- .../my_introduction_to_hobby_programming.md | 2 +- contents/notation/notation.md | 2 +- contents/physics_solvers/physics_solvers.md | 2 +- contents/plotting/plotting.md | 2 +- .../quantum_information.md | 2 +- contents/quantum_systems/quantum_systems.md | 2 +- .../split-operator_method.md | 2 +- .../stable_marriage_problem.md | 2 +- .../stacks_and_queues/stacks_and_queues.md | 2 +- .../taylor_series_expansion.md | 2 +- contents/thomas_algorithm/thomas_algorithm.md | 2 +- contents/tree_traversal/tree_traversal.md | 2 +- .../verlet_integration/verlet_integration.md | 2 +- update_site.sh | 44 --- 58 files changed, 59 insertions(+), 572 deletions(-) delete mode 100644 .travis.yml delete mode 100644 contents/domain_coloring/domain_coloring.md.bak delete mode 100644 contents/flood_fill/flood_fill.md.bak delete mode 100755 update_site.sh diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 361978a7a..e07b1fade 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -2,7 +2,7 @@ name: Build and Deploy on: push: branches: - - master + - main jobs: build-and-deploy: diff --git a/.github/workflows/publish_container.yml b/.github/workflows/publish_container.yml index 84759dbdf..71c907ced 100644 --- a/.github/workflows/publish_container.yml +++ b/.github/workflows/publish_container.yml @@ -2,16 +2,16 @@ name: Publish Docker on: push: branches: - - master + - main jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@master + - uses: actions/checkout@main - name: Publish to Registry - uses: elgohr/Publish-Docker-Github-Action@master + uses: elgohr/Publish-Docker-Github-Action@main with: name: algorithm-archivists/aaa-langs username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - registry: ghcr.io \ No newline at end of file + registry: ghcr.io diff --git a/.gitignore b/.gitignore index 4d5a431b0..09a7ab178 100644 --- a/.gitignore +++ b/.gitignore @@ -528,3 +528,6 @@ build/ # Cargo artifacts Cargo.lock target/ + +*.out +*.class diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b497e39e2..000000000 --- a/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ -dist: trusty -sudo: false - -language: node_js -node_js: - - "12" - -before_script: - - export BOOK_BUILD_DIR="${TRAVIS_BUILD_DIR}"/_book - - env | sort - -script: - - npm run build - # Make sure the book built. - - | - book_check_file="${BOOK_BUILD_DIR}/index.html" - if [[ ! -f "${book_check_file}" ]]; then - echo "${book_check_file} not found" - exit 1 - fi - -after_success: - - | - if [[ "${TRAVIS_BRANCH}" == master && "${TRAVIS_PULL_REQUEST}" == false ]]; then - # Commits to master that are not pull requests, that is, only - # actual addition of code to master, should deploy the book to - # the site. - bash "${TRAVIS_BUILD_DIR}"/tools/deploy/update_site_travis.bash - fi diff --git a/contents/IFS/IFS.md b/contents/IFS/IFS.md index 9431e4631..cd503ae46 100644 --- a/contents/IFS/IFS.md +++ b/contents/IFS/IFS.md @@ -246,7 +246,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/affine_transformations/affine_transformations.md b/contents/affine_transformations/affine_transformations.md index 88f140443..439440b80 100644 --- a/contents/affine_transformations/affine_transformations.md +++ b/contents/affine_transformations/affine_transformations.md @@ -308,7 +308,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/approximate_counting/approximate_counting.md b/contents/approximate_counting/approximate_counting.md index ae4a765d6..5e06e43b5 100644 --- a/contents/approximate_counting/approximate_counting.md +++ b/contents/approximate_counting/approximate_counting.md @@ -380,7 +380,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/backward_euler_method/backward_euler_method.md b/contents/backward_euler_method/backward_euler_method.md index ba3d72ba2..090ffb191 100644 --- a/contents/backward_euler_method/backward_euler_method.md +++ b/contents/backward_euler_method/backward_euler_method.md @@ -13,7 +13,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/barnes_hut_algorithm/barnes_hut_algorithm.md b/contents/barnes_hut_algorithm/barnes_hut_algorithm.md index f4d4301b5..83c6f6003 100644 --- a/contents/barnes_hut_algorithm/barnes_hut_algorithm.md +++ b/contents/barnes_hut_algorithm/barnes_hut_algorithm.md @@ -16,7 +16,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/barnsley/barnsley.md b/contents/barnsley/barnsley.md index 9c353f8b4..6b2d6b3bf 100644 --- a/contents/barnsley/barnsley.md +++ b/contents/barnsley/barnsley.md @@ -151,7 +151,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/bitlogic/bitlogic.md b/contents/bitlogic/bitlogic.md index 077bf278c..c6b1dd9fd 100644 --- a/contents/bitlogic/bitlogic.md +++ b/contents/bitlogic/bitlogic.md @@ -148,7 +148,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/cc/license.txt b/contents/cc/license.txt index e9c662f91..1e11bba93 100644 --- a/contents/cc/license.txt +++ b/contents/cc/license.txt @@ -3,7 +3,7 @@ ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/chans_algorithm/chans_algorithm.md b/contents/chans_algorithm/chans_algorithm.md index 62e125114..18daaa889 100644 --- a/contents/chans_algorithm/chans_algorithm.md +++ b/contents/chans_algorithm/chans_algorithm.md @@ -10,7 +10,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/choosing_a_language/choosing_a_language.md b/contents/choosing_a_language/choosing_a_language.md index 88ad8c986..5385c309a 100644 --- a/contents/choosing_a_language/choosing_a_language.md +++ b/contents/choosing_a_language/choosing_a_language.md @@ -73,7 +73,7 @@ Please let me know which languages you want to cover and I'll add them here! ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/compiled_languages/compiled_languages.md b/contents/compiled_languages/compiled_languages.md index 3f6424359..b8bac2e75 100644 --- a/contents/compiled_languages/compiled_languages.md +++ b/contents/compiled_languages/compiled_languages.md @@ -35,7 +35,7 @@ I just find it easier to avoid GUI's whenever possible. ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/computational_geometry/computational_geometry.md b/contents/computational_geometry/computational_geometry.md index a99c0a4e9..bcd702fd7 100644 --- a/contents/computational_geometry/computational_geometry.md +++ b/contents/computational_geometry/computational_geometry.md @@ -12,7 +12,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/computus/computus.md b/contents/computus/computus.md index 3a881cdb0..c3ec51f09 100644 --- a/contents/computus/computus.md +++ b/contents/computus/computus.md @@ -343,7 +343,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/convolutions/1d/1d.md b/contents/convolutions/1d/1d.md index 9a2e652d1..ecf56a1df 100644 --- a/contents/convolutions/1d/1d.md +++ b/contents/convolutions/1d/1d.md @@ -304,7 +304,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Images/Graphics - The image "[Square Wave](../res/square_wave.png)" was created by [James Schloss](https://github.com/leios) and is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/legalcode). diff --git a/contents/convolutions/2d/2d.md b/contents/convolutions/2d/2d.md index dc52157fe..e2cace847 100644 --- a/contents/convolutions/2d/2d.md +++ b/contents/convolutions/2d/2d.md @@ -170,7 +170,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Images/Graphics - The image "[8bit Heart](../res/heart_8bit.png)" was created by [James Schloss](https://github.com/leios) and is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/legalcode). diff --git a/contents/convolutions/convolutional_theorem/convolutional_theorem.md b/contents/convolutions/convolutional_theorem/convolutional_theorem.md index 1034f2018..b47bec179 100644 --- a/contents/convolutions/convolutional_theorem/convolutional_theorem.md +++ b/contents/convolutions/convolutional_theorem/convolutional_theorem.md @@ -62,7 +62,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Images/Graphics diff --git a/contents/cooley_tukey/cooley_tukey.md b/contents/cooley_tukey/cooley_tukey.md index b30052e40..d528832d1 100644 --- a/contents/cooley_tukey/cooley_tukey.md +++ b/contents/cooley_tukey/cooley_tukey.md @@ -265,7 +265,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/data_compression/data_compression.md b/contents/data_compression/data_compression.md index 1f48c0c99..5a04c3706 100644 --- a/contents/data_compression/data_compression.md +++ b/contents/data_compression/data_compression.md @@ -130,7 +130,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/data_structures/data_structures.md b/contents/data_structures/data_structures.md index 11ae7aa4b..60680b95e 100644 --- a/contents/data_structures/data_structures.md +++ b/contents/data_structures/data_structures.md @@ -7,7 +7,7 @@ The fundamental building blocks of algorithms are data structures, and thus as m ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/decision_problems/decision_problems.md b/contents/decision_problems/decision_problems.md index 064c1d067..2ab9ed612 100644 --- a/contents/decision_problems/decision_problems.md +++ b/contents/decision_problems/decision_problems.md @@ -14,7 +14,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/differential_equations/differential_equations.md b/contents/differential_equations/differential_equations.md index 3cfbba1fa..0bb08349c 100644 --- a/contents/differential_equations/differential_equations.md +++ b/contents/differential_equations/differential_equations.md @@ -7,7 +7,7 @@ Here, we discuss many different methods to solve particular sets of differential ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/domain_coloring/domain_coloring.md b/contents/domain_coloring/domain_coloring.md index 39159e650..9c536bb50 100644 --- a/contents/domain_coloring/domain_coloring.md +++ b/contents/domain_coloring/domain_coloring.md @@ -190,7 +190,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/domain_coloring/domain_coloring.md.bak b/contents/domain_coloring/domain_coloring.md.bak deleted file mode 100644 index 8ec9129ad..000000000 --- a/contents/domain_coloring/domain_coloring.md.bak +++ /dev/null @@ -1,185 +0,0 @@ -# Domain coloring - -Domain coloring is a much more complicated plotting technique than those outlined in the [plotting chapter](../plotting/plotting.md) and is used to plot complex functions where both the input and output have imaginary and real components. -For the code in this chapter, we will focus on languages that are easily able to plot two-dimensional images or heatmaps, instead of languages meant for number-crunching. -That is to say that this chapter will certainly have a code implementation in gnuplot, but it will not likely have an implementation in C, Fortran, or Java because these languages do not have plotting capabilities in-built. - -Imagine the following function: $$f(z) = z^2$$. -In this case, we could create a plot that looks like this: - -

- -

- -This indicates that for various input values along $$z$$, we have different function outputs from $$f(z)$$. -Now let's imagine another function with complex input $$(z \in \mathbb{C})$$, but a purely real output $$(f(z) \in \mathbb{R})$$: - -$$ -f(z) = |z| -$$ - -In this case, each complex input has a real output. -This can be plotted as a two-dimensional dataset like so: - -

- -

- -Here, the $$x$$-axis and $$y$$-axis represent the real and imaginary components of the input variable, respectively. -The colorbar represents the output of $$f(z)$$. - -At this point, we can start to see the problem. -If the output of $$f(z)$$ also requires plotting of the real and imaginary components, then we would need four dimensions to appropriately represent the function space, one axis for the real component and another for the imaginary component of both the input ($$z$$) and the output of $$f(z)$$! -Unfortunately, feeble human minds are incapable of understanding four spatial dimensions without projecting onto lower dimensionality, so we need to improvise. - -We do this by assuming the complex output can be represented in the following form: - -$$ -z = re^{i \theta} = r(\cos(\theta) + i\sin(\theta)) -$$ - -where, $$r$$ is a complex magnitude and $$\theta$$ is a complex phase. -This is the formula for a circle in the complex plane and we can easily find $$r$$ and $$\theta$$ like so: - -$$ -\begin{align} - r &= \sqrt{\text{Re}(z)^2 + \text{Im}(z)^2} \\ - \theta &= \text{atan}\left(\frac{\text{Im}(z)}{\text{Re}(z)}\right) -\end{align} -$$ - -Once we have our complex function output in this form, we then color the output domain according to a color space with at least 2 independent dimensions, like RGB (Red, Green, Blue), or HSV (Hue, Saturation, Value) [CITE]. -The choice of color space is completely dependent on what the users feel is most visually intuitive. -In any case, one dimension of the color system will be used to represent the complex magnitude of the output and another dimension of the color system will be used to represent the complex phase. -The $$xy$$ grid will be representing the real and imaginary inputs to these functions. -That is to say, we plug every value in the 2D complex plane into the function and then color each pixel based on the function output. - -As an example, let's look at the simplest function we can $$f(z) = z$$, but in this case $$z \in \mathbb{C}$$. -If we use an RGB color scheme, where red represents $$\theta$$ and blue represents $$r$$, we can generate the following image: - -

- -

- -As a note here, there is a clear phase discontinuity along the vertical axis. -That is to say that the complex phase wraps around the origin, ranging from 0 (clear) to $$2\pi$$ (red). -In addition, the edges of the plot are blue because the function value increases linearly as we move from the origin. - -If we instead look at the function $$f(z) = z^2$$, we can generate a similar plot: - -

- -

- -Here, it is clear that the complex phase wraps around the origin twice, creating two separate phase discontinuities on top of each other. -This indicates a $$4\pi$$ phase winding, and for some purposes, such as vortex tracking for inviscid fluids, this visualizaton is ideal, because a vortex is located precisely at the phase discontinuity [CITE]. -For other purposes, the discontinuity is visually distracting, and for this reason, many people use an HSV scheme for plotting complex functions. -So here is the same function $$\left(f(z)=z^2\right)$$, but using hue to represent the complex phase and saturation to represent the magnitude. - -

- -

- -Here, the value for HSV was always set to 1. -When looking at the edges of the plot, the hue changes rapidly, but each color is mirrored on the oposite edge. -This indicates the $$4\pi$$ phase winding we saw in the RGB plots. -Also, because the complex magnitude increases as we move further from the center of the plot, the saturation also increases. -Thus the very center of the plot is completely washed out! -We need to fix this in subsequent plots to make them representative of the actual data. - -One easy way to show that the complex magnitude is increasing as we move further from the origin is with contours. -Essentially, at ever integer value of the magnitude, we want to draw some kind of line. -There are a number of ways to generate these lines, and one simple way is by using an alternative shading function like so: - -$$ -g(r) = r-\lfloor r \rfloor. -$$ - -This will create the following image: - -

- -

- -This function will essentially create a smooth gradient, but because of the floor operation $$\left(\lfloor \cdot \rfloor \right)$$, the saturation will go from 0 to 1 between each integer value of the magnitude. -Here, it is clear that the magnitude is increasing as $$z^2$$ from the origin; however, because the saturation is fluctuating so much, it is difficult to see the phase pattern next to each contour. -This can be fixed simply by adding an offset to the shading function such that, - -$$ -g(r) = \frac{1}{2} + \frac{1}{2}\left(r-\lfloor r \rfloor \right). -$$ - -Which will produce the following image: - -

- -

- -This means that the saturation will fluctuate from $$\frac12$$ to 1 instead of from 0 to 1, which makes it way easier to see phase information next to contours. -Again, there is a lot of ways to play with these equations, so feel free to use whatever function you want! -As long as some sort of rounding operation is used to establish some form of integer value for the magnitude, it should be possible to create contours of various types. - -Unfortunately, there the changing saturation only shows changes in the complex magnitude, and changing hue only shows changes in the complex phase. -Neither the magnitude or the phase directly show what is happening in real or imaginary space with the output. -To show this, we might want to draw gridlines that color out grid black whenever the imaginary or real components of the output function are integer values. - -For example, let's go back to a simpler function $$f(z) = z$$. -If we draw lines on this plot, corresponding to integer values in the output, we get a simple grid - -

- -

- -Like before, the choice of which function to use in order to create the gridlines is somewhat arbitrary. -It is important to choose a function that sharply drops to 0 or peaks at 1 for all integer values, and then you multiply this by the output of $$f(z)$$. -For these purposes, we chose the following function - -$$ -h(z) = |\sin(\pi\times\text{Re}(f(z)))^t|\times|\sin(\pi\times\text{Im}(f(z)))^t|, -$$ - -where $$t$$ is some threshold value, and was set to be 0.1 in our plot. -A plot of h(z) for $$f(z) = z$$ where $$z\in\mathbb{R}$$ is shown below: - -

- -

- -So, putting it altogether and returning to the function of $$f(z) = z^2$$, we find the following image. - -

- -

- -Here, the diagonal lines through the center represent integer values along the imaginary axis for $$f(z)$$ and the vertical and horizontal represent integer values of the real axis for $$f(z)$$. - -## Example Code - -Here is the full script to generate a domain colored output of $$f(z)=z^2$$. - -### Bibliography - -{% references %} {% endreferences %} - - - -## License - -##### Code Examples - -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). - -##### Text - -The text of this chapter was written by [James Schloss](https://github.com/leios) and is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/legalcode). - -[

](https://creativecommons.org/licenses/by-sa/4.0/) - -##### Images/Graphics - -##### Pull Requests - -The following pull requests have modified the text or graphics of this chapter: -- none diff --git a/contents/euclidean_algorithm/euclidean_algorithm.md b/contents/euclidean_algorithm/euclidean_algorithm.md index 1d6211a37..cebf550ba 100644 --- a/contents/euclidean_algorithm/euclidean_algorithm.md +++ b/contents/euclidean_algorithm/euclidean_algorithm.md @@ -302,7 +302,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/flood_fill/flood_fill.md b/contents/flood_fill/flood_fill.md index 4c7e5936e..62348f107 100644 --- a/contents/flood_fill/flood_fill.md +++ b/contents/flood_fill/flood_fill.md @@ -279,7 +279,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/flood_fill/flood_fill.md.bak b/contents/flood_fill/flood_fill.md.bak deleted file mode 100644 index d15b1ef97..000000000 --- a/contents/flood_fill/flood_fill.md.bak +++ /dev/null @@ -1,258 +0,0 @@ -# Flood Fill - -Flood fill is a method that is surprisingly useful in a large number of different situations and keeps finding me wherever I go. -When I was completing my PhD, I had an idea to track superfluid vortices by using flood fill as a way to help mask out unnecessary features of the simulation. -When I was making a terminal game, I thought of creating an animation that was just flood fill in disguise. -When I decided to play minesweeper or Go with my girlfriend, flood fill was used in both! - -Flood fill is probably most commonly known as the "Bucket Fill" application in most art programs {{ "gimp_bucket" | cite }}. -It's usually indicated by an icon that looks like a bucket and is known to fill in any enclosed area, as shown below: - -

- -

- -Because flood fill is incredibly common, there are a large number of variations to the method, some of which are more optimal than others. -For this chapter, we will cover the basics: how to fill a domain in a quick and dirty way. -In subsequent chapters, we will continue our journey by creating more and more efficient flood fill methods, including scanline-based and fixed memory methods {{ "torbert2016" | cite }}. - -I have decided to split the chapter up for a few important reasons: -1. I did not want to flood the Algorithm Archive with flood fill methods all at the same time. -I feel it's worth letting each chapter sit for a bit while we savour it's unique flavour. -2. Many users are implementing versions of each algorithm in their own languages and it is difficult to review and submit code for chapters with a lot of code chunks. -Several sub-chapters with less code is easier for everyone. -3. I am kinda under a time-constraint right now and wanted to make sure we regularly get content into the Algorithm Archive. - -So, without further a-do, let's hop right into it! - - -## What does flood fill do? - -Flood fill is essentially composed of 2 parts: -1. Determining the extents of the domain to fill -2. Walking through all elements within a domain and changing some property - -For the purposes of this chapter, we will be using a set of floating-point values that range from 0 to 1 instead of a color-space like RGB. -Though bucket fill is always used in art programs in some sort of color space, flood fill is more general and can be used in a space with any type of element. -As such, it makes sense to use a simpler element type so we can better understand the method. - -So how do we go about finding the extents of the domain to fill? - -Here, a domain will be defined as any connected set of elements in an $$n$$-dimensional space whose values do not vary beyond a pre-defined threshold. -As an example, if we take a circle embedded into a 2-dimensional grid, we have 3 separate domains: -1. Inside the circle where all elements are 0. -2. The circle, itself, where the elements are set to 0.75. -3. Outside the circle where all elements are similarly 0. - -

- -

- -Though there are some more complicated ways to determine the extents of the domain, we will not focus on this aspect of the flood fill method for the remainder of this chapter and instead leave it for subsequent chapters. -So now we will focus on the process of walking through each element in the domain and changing some property. - -## Domain traversal - -As before, the simplest example to work with is that of an image, where each element in our domain is a single pixel. -Here, we can connect each pixel to all other pixels in its vicinity, like so: - -

- -

- -In this image, a border is shown between each individual pixel and a grid is superimposed to show how each pixel is connected to its neighbors. -This means that each element has 4 neighbors: north, south, east, and west. -We could also include northeast, southeast, southwest, and northwest if we wanted to do an 8-way fill, but we will restrict the discussion to the 4-way fill for now, as the method is essentially the same and slightly easier to understand with fewer elements to worry about. - -By connecting each pixel to its neighbors in this way, the flood fill operation becomes a process of graph traversal, not too dissimilar from the [tree traversal](../tree_traversal/tree_traversal.md) methods described before. -This means that after selecting our initial location, we can then traverse through all elements in either a depth-first or breadth-first fashion. -We will be covering the following this chapter: - -1. Finding all neighbours -2. Depth-first node traversal -3. Breadth-first node traversal and small-scale optimizations - -So let's start by discussing how we might go about finding the neighbors to fill. - -### Finding all neighbors - -The first step of this method is to query the location of all possible neighbors. -At first glance, this seems rather straightforward. -One simply needs to look up, down, left, and right of the current location and add those elements to the list of neighbors if they are: - -1. On the canvas -2. Have a value *close enough* to the old value we would like to replace - -In code, this might look like this: - -{% method %} -{% sample lang="jl" %} -[import:37-55, lang:"julia"](code/julia/flood_fill.jl) -{% endmethod %} - - -This code is set up to return a vector of elements to then use for subsequent sections. - -### Depth-first node traversal - -Now that we have the ability to find all neighboring elements, we can proceed to traverse through those nodes in the most straightforward way: recursion. - -In code, it might look like this: - -{% method %} -{% sample lang="jl" %} -[import:106-118, lang:"julia"](code/julia/flood_fill.jl) - -All Julia code snippets for this chapter rely on an exterior `color!(...)` function, defined as - -[import:23-35, lang:"julia"](code/julia/flood_fill.jl) -{% endmethod %} - -The above code continues recursing through available neighbors as long as neighbors exist, and this should work so long as we are adding the correct set of neighbors. - -Additionally, it is possible to do the same type of traversal by managing a stack, like so: - -{% method %} -{% sample lang="jl" %} -[import:57-77, lang:"julia"](code/julia/flood_fill.jl) -{% endmethod %} - -This is ultimately the same method of traversal as before; however, because we are managing our own data structure, there are a few distinct differences: -1. The manually managed stack could be slightly slower and potentially more memory-intensive -2. It is easy to reach the maximum recursion depth on certain hardware with the recursive method, so it is best to use the stack-based implementation in those cases. - -If we were to use either of these methods to fill a circle embedded in a two dimensional domain, we would see the following - -
- -
- -Here, we see that these methods will traverse through one direction first before filling from there. -This is potentially the easiest method to write, but it is not the most intuitive fill pattern. -I suspect that if someone was asked to fill the contents of the circle on their own, they would fill it more evenly from the center, like so: - -
- -
- -This is simply another traversal strategy known as breadth-first traversal and comes with its own set of caveats. -We will discuss this further in the next subsection - -### Breadth-first node traversal and small-scale optimizations - -Breadth-first node traversal is as simple as switching the stack in the depth-first strategy with a queue. -The code would look something like this: - -{% method %} -{% sample lang="jl" %} -[import:80-104, lang:"julia"](code/julia/flood_fill.jl) -{% endmethod %} - -Now, there is a small trick in this code that must be considered to make sure it runs optimally. -Namely, the nodes must be colored *when they are being enqueued*, not when visiting the node. -At least for me, it was not immediately obvious why this would be the case, but let me try to explain. - -Let's imagine that we decided to write code that colored all neighboring nodes only when visiting them. -When querying all possible neighbors, we will add 4 elements to the queue for the north, south, east, and west neighbors of the initial node, as shown below: - -

- -

- -Now let's imagine we travel east first. -It then enqueues three more nodes: north, south, and east again. -This is shown below: - -

- -

- -It does not enqueue its west neighbour because this has already been colored. -At this stage, we will have six nodes ready to be colored and 2 that are already colored. -Now let's say we travel north next. -This node will enqueue three more nodes: west, north, and east, as shown below: - -

- -

- -The problem is that the east element has *already been enqueued for coloring by the previous node*!. -This shared element is colored in red. -As we progress through all four initial neighbours, we will find 4 nodes that are doubly enqueued: all directions diagonal to the initial location! -This is again shown below: - -

- -

- -As the number of nodes increases, so does the number of duplicate nodes. -A quick fix is to color the nodes *when they are being enqueud* like in the example code above. -When doing this, duplicates will not be enqueued with a breadth-first scheme because they will already be colored when other nodes are trying to find their neighbors. -This created a node connection pattern like so: - -

- -

- -As some final food for thought: why wasn't this a problem with the depth-first strategy? -The simple answer is that it actually was an issue, but it was way less prevalent. -With the depth-first strategy, a number of unnecessary nodes are still pushed to the stack, but because we consistently push one direction before spreading out to other directions, it is more likely that the nodes have filled neighbours when they are looking for what to fill around them. - -Simply put: depth-first traversal is slightly more efficient in this case unless you can color as querying for neighbors, in which case breadth-first is more efficient. - -## Conclusions - -As stated before, the method discussed in this chapter is just the tip of the iceberg and many other flood fill methods exist that are likely to be more efficient for most purposes. -These will all be covered in subsequent chapters which will come out somewhat regularly throughout the next few months, lest we flood that archive with flood fill methods. - -## Example Code - -The example code for this chapter will be the simplest application of flood fill that still adequately tests the code to ensure it is stopping at boundaries appropriately. -For this, we will create a two dimensional array of floats, all starting at 0.0, and then set a single vertical line of elements at the center to be 1.0. -After, we will fill in the left-hand side of the array to be all ones by choosing any point within the left domain to fill. - -{% method %} -{% sample lang="jl" %} -[import, lang:"julia"](code/julia/flood_fill.jl) -{% endmethod %} - - -### Bibliography - -{% references %} {% endreferences %} - - - -## License - -##### Code Examples - -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). - -##### Text - -The text of this chapter was written by [James Schloss](https://github.com/leio) and is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/legalcode). - -[

](https://creativecommons.org/licenses/by-sa/4.0/) - -##### Images/Graphics -- The image "[Example Bucket Fill](res/example.png)" was created by [James Schloss](https://github.com/leios) and is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/legalcode). -- The image "[Circle Domains](res/simple_circle.png)" was created by [James Schloss](https://github.com/leios) and is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/legalcode). -- The image "[Grid 1](res/grid_1.png)" was created by [James Schloss](https://github.com/leios) and is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/legalcode). -- The image "[Grid 2](res/grid_2.png)" was created by [James Schloss](https://github.com/leios) and is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/legalcode). -- The image "[Grid 3](res/grid_3.png)" was created by [James Schloss](https://github.com/leios) and is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/legalcode). -- The image "[Grid 4](res/grid_4.png)" was created by [James Schloss](https://github.com/leios) and is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/legalcode). -- The image "[Grid 5](res/grid_5.png)" was created by [James Schloss](https://github.com/leios) and is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/legalcode). -- The image "[Grid 6](res/grid_6.png)" was created by [James Schloss](https://github.com/leios) and is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/legalcode). -- The video "[Stack Fill](res/recurse_animation.mp4)" was created by [James Schloss](https://github.com/leios) and is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/legalcode). -- The video "[Queue Fill](res/queue_animation.mp4)" was created by [James Schloss](https://github.com/leios) and is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/legalcode). - - diff --git a/contents/fortran/fortran.md b/contents/fortran/fortran.md index f705d3c17..491a33b6e 100644 --- a/contents/fortran/fortran.md +++ b/contents/fortran/fortran.md @@ -6,7 +6,7 @@ Alright, so here's the thing about Fortran. It's old. ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/forward_euler_method/forward_euler_method.md b/contents/forward_euler_method/forward_euler_method.md index f97ff27a2..dfb185431 100644 --- a/contents/forward_euler_method/forward_euler_method.md +++ b/contents/forward_euler_method/forward_euler_method.md @@ -156,7 +156,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/gaussian_elimination/gaussian_elimination.md b/contents/gaussian_elimination/gaussian_elimination.md index 8caf869ed..4eaf61570 100644 --- a/contents/gaussian_elimination/gaussian_elimination.md +++ b/contents/gaussian_elimination/gaussian_elimination.md @@ -591,7 +591,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/gift_wrapping/gift_wrapping.md b/contents/gift_wrapping/gift_wrapping.md index 176463672..59bbc4d91 100644 --- a/contents/gift_wrapping/gift_wrapping.md +++ b/contents/gift_wrapping/gift_wrapping.md @@ -14,7 +14,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/graham_scan/graham_scan.md b/contents/graham_scan/graham_scan.md index 7b84f3acd..7b46422cb 100644 --- a/contents/graham_scan/graham_scan.md +++ b/contents/graham_scan/graham_scan.md @@ -105,7 +105,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/how_to_contribute/how_to_contribute.md b/contents/how_to_contribute/how_to_contribute.md index 010bc9a26..abab57490 100644 --- a/contents/how_to_contribute/how_to_contribute.md +++ b/contents/how_to_contribute/how_to_contribute.md @@ -36,7 +36,7 @@ Thanks for all the support and considering contributing to the Algorithm Archive ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/huffman_encoding/huffman_encoding.md b/contents/huffman_encoding/huffman_encoding.md index 3772c97ca..881c4c47c 100644 --- a/contents/huffman_encoding/huffman_encoding.md +++ b/contents/huffman_encoding/huffman_encoding.md @@ -110,7 +110,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/introduction/introduction.md b/contents/introduction/introduction.md index dccd6e82a..b9efc5c75 100644 --- a/contents/introduction/introduction.md +++ b/contents/introduction/introduction.md @@ -22,7 +22,7 @@ So I guess that's all for now. Because this book is freely available online, I m ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/jarvis_march/jarvis_march.md b/contents/jarvis_march/jarvis_march.md index 20929d4ad..7fee2e681 100644 --- a/contents/jarvis_march/jarvis_march.md +++ b/contents/jarvis_march/jarvis_march.md @@ -62,7 +62,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/makefiles/makefiles.md b/contents/makefiles/makefiles.md index 3e23c926d..642065257 100644 --- a/contents/makefiles/makefiles.md +++ b/contents/makefiles/makefiles.md @@ -6,7 +6,7 @@ COMING SOON! ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/mathematical_background/mathematical_background.md b/contents/mathematical_background/mathematical_background.md index 4ed9afb45..fa0f36839 100644 --- a/contents/mathematical_background/mathematical_background.md +++ b/contents/mathematical_background/mathematical_background.md @@ -16,7 +16,7 @@ In those cases, we will place the mathematical methods in more relevant sections ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/matrix_methods/matrix_methods.md b/contents/matrix_methods/matrix_methods.md index 96ae1c8b7..89f3f8e3b 100644 --- a/contents/matrix_methods/matrix_methods.md +++ b/contents/matrix_methods/matrix_methods.md @@ -17,7 +17,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/monte_carlo_integration/monte_carlo_integration.md b/contents/monte_carlo_integration/monte_carlo_integration.md index 964de7bbe..c01a6cbbd 100644 --- a/contents/monte_carlo_integration/monte_carlo_integration.md +++ b/contents/monte_carlo_integration/monte_carlo_integration.md @@ -220,7 +220,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/multiplication/multiplication.md b/contents/multiplication/multiplication.md index ea430dee2..75ce2e9cb 100644 --- a/contents/multiplication/multiplication.md +++ b/contents/multiplication/multiplication.md @@ -25,7 +25,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/my_introduction_to_hobby_programming/my_introduction_to_hobby_programming.md b/contents/my_introduction_to_hobby_programming/my_introduction_to_hobby_programming.md index 98ad6607d..eb3260ce9 100644 --- a/contents/my_introduction_to_hobby_programming/my_introduction_to_hobby_programming.md +++ b/contents/my_introduction_to_hobby_programming/my_introduction_to_hobby_programming.md @@ -72,7 +72,7 @@ Basically, since the first time I was able to directly interact with my computer ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/notation/notation.md b/contents/notation/notation.md index 793698d0b..f8242ddde 100644 --- a/contents/notation/notation.md +++ b/contents/notation/notation.md @@ -208,7 +208,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/physics_solvers/physics_solvers.md b/contents/physics_solvers/physics_solvers.md index 6192b4681..12d24c366 100644 --- a/contents/physics_solvers/physics_solvers.md +++ b/contents/physics_solvers/physics_solvers.md @@ -12,7 +12,7 @@ For example, there are many different ways to solve the Schrödinger equation, h ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/plotting/plotting.md b/contents/plotting/plotting.md index 2ad1ae63f..0fd858f6b 100644 --- a/contents/plotting/plotting.md +++ b/contents/plotting/plotting.md @@ -574,7 +574,7 @@ Here, we have provided all of the essential skills to plot any data that comes f ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/quantum_information/quantum_information.md b/contents/quantum_information/quantum_information.md index 56636b724..7916d36b7 100644 --- a/contents/quantum_information/quantum_information.md +++ b/contents/quantum_information/quantum_information.md @@ -33,7 +33,7 @@ As always, this section will be updated as we add more algorithms to the list. ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/quantum_systems/quantum_systems.md b/contents/quantum_systems/quantum_systems.md index c602aaea1..71eb9305a 100644 --- a/contents/quantum_systems/quantum_systems.md +++ b/contents/quantum_systems/quantum_systems.md @@ -260,7 +260,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/split-operator_method/split-operator_method.md b/contents/split-operator_method/split-operator_method.md index ad4fd6c0e..1af23e331 100644 --- a/contents/split-operator_method/split-operator_method.md +++ b/contents/split-operator_method/split-operator_method.md @@ -203,7 +203,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/stable_marriage_problem/stable_marriage_problem.md b/contents/stable_marriage_problem/stable_marriage_problem.md index 2e8850a01..dc7f031ab 100644 --- a/contents/stable_marriage_problem/stable_marriage_problem.md +++ b/contents/stable_marriage_problem/stable_marriage_problem.md @@ -68,7 +68,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/stacks_and_queues/stacks_and_queues.md b/contents/stacks_and_queues/stacks_and_queues.md index 89a77be9a..5d637deb3 100644 --- a/contents/stacks_and_queues/stacks_and_queues.md +++ b/contents/stacks_and_queues/stacks_and_queues.md @@ -35,7 +35,7 @@ Here is a simple implementation of a queue: ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/taylor_series_expansion/taylor_series_expansion.md b/contents/taylor_series_expansion/taylor_series_expansion.md index 29ba87be4..76effd506 100644 --- a/contents/taylor_series_expansion/taylor_series_expansion.md +++ b/contents/taylor_series_expansion/taylor_series_expansion.md @@ -51,7 +51,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/thomas_algorithm/thomas_algorithm.md b/contents/thomas_algorithm/thomas_algorithm.md index 81bb47617..607e9741a 100644 --- a/contents/thomas_algorithm/thomas_algorithm.md +++ b/contents/thomas_algorithm/thomas_algorithm.md @@ -147,7 +147,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/tree_traversal/tree_traversal.md b/contents/tree_traversal/tree_traversal.md index 5dc6657e0..566aca469 100644 --- a/contents/tree_traversal/tree_traversal.md +++ b/contents/tree_traversal/tree_traversal.md @@ -388,7 +388,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/contents/verlet_integration/verlet_integration.md b/contents/verlet_integration/verlet_integration.md index 80d719bef..5d993b4f4 100644 --- a/contents/verlet_integration/verlet_integration.md +++ b/contents/verlet_integration/verlet_integration.md @@ -234,7 +234,7 @@ MathJax.Hub.Queue(["Typeset",MathJax.Hub]); ##### Code Examples -The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/master/LICENSE.md)). +The code examples are licensed under the MIT license (found in [LICENSE.md](https://github.com/algorithm-archivists/algorithm-archive/blob/main/LICENSE.md)). ##### Text diff --git a/update_site.sh b/update_site.sh deleted file mode 100755 index 0ccf8f7bb..000000000 --- a/update_site.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env bash - -if [ $# -ge 1 ]; then - if [ $# -eq 2 ]; then - out_dir="$2" - else - if [ -z ${AAA_DIR+x} ]; then - echo "No output directory specified" - exit 1 - fi - out_dir="$AAA_DIR" - fi - - if [[ ! -d "$out_dir" ]]; then - echo "$out_dir is not a directory" - exit 1 - fi - - npm run build . /tmp/algorithm-archivists.github.io - - if [ $? -ne 0 ]; then - echo "Failed to build the book" - exit 1 - fi - - cd "$out_dir" - git reset --hard && \ - git clean -dfx && \ - git pull origin master - - if [ $? -ne 0 ]; then - echo "Failed to prepare repository" - exit 1 - fi - - cp -r /tmp/algorithm-archivists.github.io/* . - rm -r /tmp/algorithm-archivists.github.io - git add . - git commit -m "$1" - git push origin master - -else - echo "No commit message specified" -fi From 5f560b3cbbd06e0b10d6cd5999c1a037aeebd81e Mon Sep 17 00:00:00 2001 From: James Schloss Date: Tue, 30 Nov 2021 08:46:18 +0100 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Dimitri Belopopsky --- .github/workflows/publish_container.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish_container.yml b/.github/workflows/publish_container.yml index 71c907ced..ab76a3e0b 100644 --- a/.github/workflows/publish_container.yml +++ b/.github/workflows/publish_container.yml @@ -7,9 +7,9 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@main + - uses: actions/checkout@master - name: Publish to Registry - uses: elgohr/Publish-Docker-Github-Action@main + uses: elgohr/Publish-Docker-Github-Action@master with: name: algorithm-archivists/aaa-langs username: ${{ github.actor }}