Misc matrix algorithms using MPFR#
- sage.matrix.misc_mpfr.hadamard_row_bound_mpfr(A)[source]#
Given a matrix \(A\) with entries that coerce to
RR
, compute the row Hadamard bound on the determinant.INPUT:
A
– a matrix overRR
OUTPUT:
integer – an integer n such that the absolute value of the determinant of this matrix is at most \(10^n\).
EXAMPLES:
We create a very large matrix, compute the row Hadamard bound, and also compute the row Hadamard bound of the transpose, which happens to be sharp.
sage: a = matrix(ZZ, 2, [2^10000, 3^10000, 2^50, 3^19292]) sage: from sage.matrix.misc_mpfr import hadamard_row_bound_mpfr sage: hadamard_row_bound_mpfr(a.change_ring(RR)) 13976 sage: len(str(a.det())) 12215 sage: hadamard_row_bound_mpfr(a.transpose().change_ring(RR)) 12215
>>> from sage.all import * >>> a = matrix(ZZ, Integer(2), [Integer(2)**Integer(10000), Integer(3)**Integer(10000), Integer(2)**Integer(50), Integer(3)**Integer(19292)]) >>> from sage.matrix.misc_mpfr import hadamard_row_bound_mpfr >>> hadamard_row_bound_mpfr(a.change_ring(RR)) 13976 >>> len(str(a.det())) 12215 >>> hadamard_row_bound_mpfr(a.transpose().change_ring(RR)) 12215
Note that in the above example using RDF would overflow:
sage: b = a.change_ring(RDF) sage: b._hadamard_row_bound() Traceback (most recent call last): ... OverflowError: cannot convert float infinity to integer
>>> from sage.all import * >>> b = a.change_ring(RDF) >>> b._hadamard_row_bound() Traceback (most recent call last): ... OverflowError: cannot convert float infinity to integer