Skip to content
Open
Changes from all commits
Commits
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
78 changes: 78 additions & 0 deletions src/matrix/matrix_special.jl
Original file line number Diff line number Diff line change
@@ -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