def chow(n, alpha=1, delta=0): """ chow(n, alpha, delta): chow matrix - a singular toeplitz lower hessenberg matrix. a = chow(n, alpha, delta) is a toeplitz lower hessenberg matrix a = h(alpha) + delta*eye, where h(i,j) = alpha^(i-j+1). h(alpha) has p = floor(n/2) zero eigenvalues, the rest being 4*alpha*cos( k*pi/(n+2) )^2, k=1:n-p. defaults: alpha = 1, delta = 0. References: T.S. Chow, A class of Hessenberg matrices with known eigenvalues and inverses, SIAM Review, 11 (1969), pp. 391-395. G. Fairweather, On the eigenvalues and eigenvectors of a class of Hessenberg matrices, SIAM Review, 13 (1971), pp. 220-221. """ a = toeplitz(alpha ** np.arange(1, n + 1), np.hstack((alpha, 1, np.zeros(n - 2)))) + delta * np.eye(n) return a
def chow(n, alpha=1, delta=0): """ chow(n, alpha, delta): chow matrix - a singular toeplitz lower hessenberg matrix. a = chow(n, alpha, delta) is a toeplitz lower hessenberg matrix a = h(alpha) + delta*eye, where h(i,j) = alpha^(i-j+1). h(alpha) has p = floor(n/2) zero eigenvalues, the rest being 4*alpha*cos( k*pi/(n+2) )^2, k=1:n-p. defaults: alpha = 1, delta = 0. References: T.S. Chow, A class of Hessenberg matrices with known eigenvalues and inverses, SIAM Review, 11 (1969), pp. 391-395. G. Fairweather, On the eigenvalues and eigenvectors of a class of Hessenberg matrices, SIAM Review, 13 (1971), pp. 220-221. """ a = toeplitz(alpha ** np.arange(1, n + 1), \ np.r_[alpha, 1, np.zeros(n - 2)]) + delta * np.eye(n) return a
def prolate(n, w=0.25): """ PROLATE Prolate matrix - symmetric, ill-conditioned Toeplitz matrix. A = PROLATE(N, W) is the N-by-N prolate matrix with parameter W. It is a symmetric Toeplitz matrix. If 0 < W < 0.5 then - A is positive definite - the eigenvalues of A are distinct, lie in (0, 1), and tend to cluster around 0 and 1. W defaults to 0.25. Reference: J.M. Varah. The Prolate matrix. Linear Algebra and Appl., 187:269--278, 1993. """ a = np.zeros(n) a[0] = 2 * w a[1:n] = np.sin(2 * np.pi * w * np.arange(1, n)) / (np.pi * np.arange(1, n)) t = toeplitz(a) return t
def prolate(n, w=0.25): """ PROLATE Prolate matrix - symmetric, ill-conditioned Toeplitz matrix. A = PROLATE(N, W) is the N-by-N prolate matrix with parameter W. It is a symmetric Toeplitz matrix. If 0 < W < 0.5 then - A is positive definite - the eigenvalues of A are distinct, lie in (0, 1), and tend to cluster around 0 and 1. W defaults to 0.25. Reference: J.M. Varah. The Prolate matrix. Linear Algebra and Appl., 187:269--278, 1993. """ a = np.zeros(n) a[0] = 2 * w a[1:n] = np.sin(2 * np.pi * w * np.arange(1, n)) / \ (np.pi * np.arange(1, n)) t = toeplitz(a) return t