Skip to content

Commit d691f55

Browse files
committed
Add core/biogeography.
1 parent 6dad8a0 commit d691f55

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

core/private/biogeography.m

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
function [A,properties] = biogeography(n)
2+
%BIOGEOGRAPHY Tridiagonal matrix with nonpositive eigenvalues.
3+
% A = BIOGEOGRAPHY(N) is a singular N-by-N tridiagonal matrix
4+
% with negative eigenvalues
5+
% -2, -2*(n-2)/(n-1), ..., -4/(n-1), -2/(n-1), 0.
6+
% This matrix can be written as
7+
% -eye(n) + anymatrix('gallery/clement',n)/(n-1).
8+
9+
% Reference:
10+
% B. Igelnik and D. Simon, The Eigenvalues of a Tridiagonal
11+
% Matrix in Biogeography, Appl. Math. Comput. 218, 195-201, 2011.
12+
13+
properties = {'tridiagonal', 'eigenvalues', 'sparse'};
14+
if nargin == 0, A = []; return, end
15+
16+
c = (1:n-1)/(n-1);
17+
A = gallery('tridiag',c(n-1:-1:1),-ones(n,1),c);

core/private/edelman27.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
% >> format long g, det(A)
66
% ans =
77
% 839466457497601
8-
% yet the exact dterminant is 839466457497600.
8+
% yet the exact determinant is 839466457497600.
99
% The matrix was found by Alan Edelman.
1010
% Strange as it may seem, this behavior does not indicate anything is
1111
% wrong with the det function and it is consistent with rounding error

readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Currently, the built-in collection contains matrices organized into 7 groups:
2020

2121
The following matrices have been added since v1.0.
2222

23+
- core/biogeography
2324
- core/collatz
2425
- core/hess_sublu
2526
- core/milnes

0 commit comments

Comments
 (0)