Handbook
Glossary
<hankel-matrix> ( n -- matrix )
Extra matrix operations
Prev:
<box-matrix> ( r -- matrix )
Next:
<hilbert-matrix> ( m n -- matrix )
Vocabulary
math
.
matrices
.
extras
Inputs
n
an
integer
Outputs
matrix
a
matrix
Word description
A Hankel matrix is a symmetric,
square-matrix
in which each ascending skew-diagonal from left to right is constant. See
hankel matrix
.
The following is true of any Hankel matrix
A
:
A[i][j] = A[j][i] = a[i+j-2]
.
The
<toeplitz-matrix>
is an upside-down Hankel matrix.
The
<hilbert-matrix>
is a special case of the Hankel matrix.
Examples
USING: math.matrices.extras prettyprint ; 4 <hankel-matrix> .
{ { 1 2 3 4 } { 2 3 4 0 } { 3 4 0 0 } { 4 0 0 0 } }
Definition
USING:
kernel
math
sequences
;
IN:
math.matrices.extras
:
<hankel-matrix>
( n -- matrix )
[
<iota>
dup
]
keep
[
[
+
abs
1
+
dup
]
]
dip
[
>
[
drop
0
]
when
]
curry
compose
cartesian-map
;