1641{
1642 double the_smallest_number = 1e-13;
1643 double epsilon2 = mpfr_get_d(
epsilon, MPFR_RNDN);
1644 epsilon2 *= epsilon2;
1645 double t_step = mpfr_get_d(
init_dt, MPFR_RNDN);
1646 double dt_min_dbl = mpfr_get_d(
min_dt, MPFR_RNDN);
1650 infinity_threshold2 *= infinity_threshold2;
1652
1656
1659
1661 printf(
1662 "epsilon2 = %e, t_step = %lf, dt_min_dbl = %lf, dt_increase_factor_dbl "
1663 "= %lf, dt_decrease_factor_dbl = %lf\n",
1664 epsilon2,
1665 t_step,
1666 dt_min_dbl,
1667 dt_increase_factor_dbl,
1668 dt_decrease_factor_dbl);
1669
1670
1674 complex* x0 = x0t0;
1675 complex* t0 = x0t0 + n;
1677
1678
1680 complex* dx = dxdt;
1681 complex* dt = dxdt + n;
1685 complex *LHS, *RHS;
1686 complex one_half(0.5, 0);
1692
1693
1694 int i, j;
1695 complex* c = s_sols;
1696 for (i = 0; i <
n_sols; i++)
1697 for (j = 0; j < n; j++, c++)
1699
1701 complex* s_s = s_sols;
1702
1703 for (
int sol_n = 0; sol_n <
n_sols; sol_n++, s_s += n, t_s++)
1704 {
1707 bool end_zone = false;
1708 double tol2 =
1709 epsilon2;
1711 *t0 = complex(0, 0);
1712
1713 *dt = complex(t_step);
1714 int predictor_successes = 0;
1715 int count = 0;
1717 1 - t0->
getreal() > the_smallest_number)
1718 {
1719 if (1 - t0->
getreal() <= end_zone_factor_dbl + the_smallest_number &&
1720 !end_zone)
1721 {
1722 end_zone = true;
1723
1724
1725 }
1726 if (end_zone)
1727 {
1729 *dt = complex(1 - t0->
getreal());
1730 }
1731 else
1732 {
1734 *dt = complex(1 - end_zone_factor_dbl - t0->
getreal());
1735 }
1736
1737 bool LAPACK_success = false;
1738
1742
1743
1744
1746 {
1748 {
1750 LHS = Hxt;
1751 RHS = Hxt + n * n;
1754 n, LHS, 1, RHS, dx);
1755 }
1756 break;
1758 {
1760 LHS = HxtH;
1761 RHS = HxtH + n * (n + 1);
1762 complex* Ht = RHS - n;
1767 n, LHS, 1, RHS, dx);
1768 }
1769 break;
1771 {
1773
1774
1776 LHS = Hxt;
1777 RHS = Hxt + n * n;
1778
1781
1782
1784 n, dx1, one_half * (*dt));
1786 n, xt, dx1);
1787 xt[n] += one_half * (*dt);
1788
1790 LHS = Hxt;
1791 RHS = Hxt + n * n;
1792
1795 n, LHS, 1, RHS, dx2);
1796
1797
1799 n, dx2, one_half * (*dt));
1802 n, xt, dx2);
1803
1804
1806 LHS = Hxt;
1807 RHS = Hxt + n * n;
1808
1810 LAPACK_success =
1812 n, LHS, 1, RHS, dx3);
1813
1814
1818 xt[n] += *dt;
1819
1821 LHS = Hxt;
1822 RHS = Hxt + n * n;
1823
1825 LAPACK_success =
1827 n, LHS, 1, RHS, dx4);
1828
1829
1839 }
1840 break;
1842 {
1844 LHS = Hxt;
1845 RHS = Hxt + n * n;
1847 n, LHS, 1, RHS, dx);
1850 double chi1;
1851
1852
1854 LHS = Hxt;
1855
1856 for (j = 0; j < n; j++)
1857 for (i = 0; i < n; i++)
1858 *(LHS + n * i + j) =
1859 *(LHS + n * i + j) *
1861
1863
1866 if (dt->getreal() > 1 - t0->
getreal())
1867 *dt = complex(1 - t0->
getreal());
1869 }
1870 break;
1871 default:
1872 ERROR(
"unknown predictor");
1873 };
1874
1875
1878
1879
1880 int n_corr_steps = 0;
1881 bool is_successful;
1882 do
1883 {
1884 n_corr_steps++;
1885
1887 LHS = HxH;
1888 RHS = HxH + n * n;
1889
1891 LAPACK_success =
1892 LAPACK_success &&
1895 is_successful =
1899
1900
1901 }
1903
1904 if (!is_successful)
1905 {
1906
1907 predictor_successes = 0;
1908 *dt = complex(dt_decrease_factor_dbl) * (*dt);
1910 }
1911 else
1912 {
1913
1914 predictor_successes = predictor_successes + 1;
1916 count++;
1917 if (is_successful &&
1919 {
1920 predictor_successes = 0;
1921 *dt = complex(dt_increase_factor_dbl) * (*dt);
1922 }
1923 }
1927 }
1928
1936 {
1937 if (sol_n % 50 == 0) printf("\n");
1939 {
1941 printf(".");
1942 break;
1944 printf("I");
1945 break;
1947 printf("M");
1948 break;
1950 printf("S");
1951 break;
1952 default:
1953 printf("-");
1954 }
1955 fflush(stdout);
1956 }
1957 }
1959
1960
1961
1974
1976}
bool cond_number_via_svd(int size, complex *A, double &cond)
bool norm_of_inverse_via_svd(int size, complex *A, double &norm)
bool solve_via_lapack_without_transposition(int size, complex *A, int bsize, complex *b, complex *x)
void zero_complex_array(int n, typename Field::element_type *a)
gmp_CC toBigComplex(const CCC *C, ring_elem a)
void add_to_complex_array(int n, typename Field::element_type *a, const typename Field::element_type *b)
void multiply_complex_array_scalar(int n, typename Field::element_type *a, const typename Field::element_type b)
void negate_complex_array(int n, typename Field::element_type *a)
#define PROJECTIVE_NEWTON
double norm2_complex_array(int n, typename Field::element_type *a)
void copy_complex_array(int n, const typename Field::element_type *a, typename Field::element_type *b)
const CCC * cast_to_CCC(const Ring *R)
const Ring * get_ring() const
ring_elem elem(int i, int j) const
void evaluate_slpHxt(int n, const complex *x0t0, complex *Hxt)
double maxDegreeTo3halves
void evaluate_slpHxH(int n, const complex *x0t0, complex *HxH)
gmp_RR dt_decrease_factor
void evaluate_slpHxtH(int n, const complex *x0t0, complex *HxtH)
int num_successes_before_increase
gmp_RR infinity_threshold
gmp_RR dt_increase_factor
int M2_numericalAlgebraicGeometryTrace
const mpreal sqrt(const unsigned int v, mp_rnd_t rnd_mode=mpreal::get_default_rnd())
#define newarray_atomic(T, len)
void make(int m, const complex *s_s)