Yes – deciding whether a 0/1 matrix can be turned into a Hankel matrix by independently permuting its rows and its columns is an NP-complete problem (so, unless P = NP, no polynomial-time algorithm exists).
Why the problem is in NP
If two permutations σ (of the rows) and τ (of the columns) are given it
takes Θ(n²) time to build the rearranged matrix
σ M τ and to verify that every north-east / south-west (skew) diagonal is
constant, so the problem is in NP.
From Hankel to Toeplitz and back
Reverse the order of the columns of a matrix (i.e. apply the fixed
permutation ρ that maps column j to column n+1–j).
A matrix H is Hankel ⇔ H ρ is Toeplitz, and conversely a matrix T is
Toeplitz ⇔ T ρ is Hankel.
Consequently
(Toeplitz-reorderability) ≤ₚ (Hankel-reorderability).
If it is NP-hard to decide whether a matrix can be permuted into a Toeplitz form, the same immediately holds for the Hankel form.
Toeplitz-reorderability is NP-complete
The NP-completeness of the “reorderable Toeplitz matrix” problem was
proved in
A. Malucelli, S. Nicoloso & M. Servilio,
“Reorderable Matrices”,
Theor. Comp. Sci. 263 (2001) 129–142.
(Theorem 4 of the paper.)
They give a polynomial reduction from Exact-3-Cover (an NP-complete problem) to the following decision problem:
RTM Input: an n×n 0/1 matrix M.
Question: do there exist permutations σ, τ such that σ M τ is
Toeplitz (i.e. every NW–SE diagonal is constant)?
Because reversing the columns changes “Toeplitz” into “Hankel”, the same construction reduces Exact-3-Cover to the Hankel version:
HTM Input: an n×n 0/1 matrix M.
Question: do there exist permutations σ, τ such that σ M τ is Hankel?
Thus HTM is NP-hard. Together with the membership in NP shown above, it is NP-complete.
Consequences
• Your Stack-Overflow question asks for a polynomial-time algorithm; the
result above explains why none has been found.
• Heuristics, exponential-time search, or algorithms that exploit special
structure (e.g. restricted numbers of distinct rows, bounded bandwidth,
etc.) are all that can be hoped for in the general case unless P = NP.
In short: “Hankelability’’ is NP-complete.
Was this answer helpful?
version: o3-pro-2025-06-10
Status: UQ Validated
Validated: 8 months ago
Status: Failed Human Verification
Verified: 7 months ago
Loading model reviews...
Loading reviews...