From 618c8a6325d16720bcebb309d6f3a97372a486cd Mon Sep 17 00:00:00 2001 From: Ateng-labrador Date: Fri, 31 Jul 2026 20:40:41 +0700 Subject: [PATCH] feat: add new algorithms --- src/matrix/matrix_special.jl | 78 ++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 src/matrix/matrix_special.jl diff --git a/src/matrix/matrix_special.jl b/src/matrix/matrix_special.jl new file mode 100644 index 00000000..abfb49d6 --- /dev/null +++ b/src/matrix/matrix_special.jl @@ -0,0 +1,78 @@ +""" + hankel(A, b = 1) +Make a hankel matrix + +# Arguments: +- A : Size of matrix + +# Example +```julia +hankel(5) +``` +# Contributors: +- [Ateng-labrador](https://github.com/Ateng-labrador) +""" +function hankel(A, b = 1) + res = [] + for i = b:A + row = [] + for j = b:A + push!(row, i + j - 1) + end + push!(res, row) + end + return res +end + + +""" + toeplite(A, b = 1) +Make a toeplite matrix + +# Arguments: +- A : Size of matrix + +# Example +```julia +toeplite(3) +``` +# Contributors: +- [Ateng-labrador](https://github.com/Ateng-labrador) +""" +function toeplite(A, b = 1) + res = [] + for i=b:A + row = [] + for j=b:A + push!(row, i - j) + end + push!(res, row) + end + return res +end + +""" + hilbert(A, b = 1) +Make a hilbert matrix + +# Arguments: +- A : Size of matrix + +# Example +```julia +hilbert(4) +``` +# Contributors: +- [Ateng-labrador](https://github.com/Ateng-labrador) +""" +function hilbert(A, b = 1) + res = [] + for i=b:A + row = [] + for j=b:A + push!(row, 1 / (i+j-1)) + end + push!(res, row) + end + return res +end