obliczenia_naukowe/l2/hilb.jl

17 lines
371 B
Julia
Raw Normal View History

2024-11-08 17:07:02 +01:00
# https://cs.pwr.edu.pl/zielinski/lectures/scna/hilb.jl
function hilb(n::Int)
# Function generates the Hilbert matrix A of size n,
# A (i, j) = 1 / (i + j - 1)
# Inputs:
# n: size of matrix A, n>=1
#
#
# Usage: hilb(10)
#
# Pawel Zielinski
if n < 1
error("size n should be >= 1")
end
return [1 / (i + j - 1) for i in 1:n, j in 1:n]
end