Skip to content

Randomly failing test in matrix_exp_pade_test #1238

Description

@rok-cesnovar

Description

After the last PR merge develop failed on Jenkins on this test in matrix_exp_pade_test. I manually restarted the Jenkins tests and it passed. The PR that was merged was a renaming PR in the Stan Math OpenCL codebase.

It seemed an unrelated PR but you can never really know so I modified the test to repeat this test for 320 times and went back to an old commit in develop https://github.com/stan-dev/math/commits/6bb33cfa No particular reason I chose this one, just went back on the git log and picked one.

void do_test(){

using Eigen::Dynamic;
  using Eigen::Matrix;
  using stan::math::matrix_v;
  using stan::math::var;

  int size = 25;

  std::random_device rd;
  std::mt19937 mt(rd());

  // Randomly construct input matrix
  Matrix<double, Dynamic, Dynamic> S = Eigen::MatrixXd::Identity(size, size),
                                   I = Eigen::MatrixXd::Identity(size, size);
  int col1, col2;
  for (int i = 0; i < 5 * size; i++) {
    col1 = rd() % size;
    col2 = rd() % size;
    while (col1 == col2)
      col2 = rd() % size;
    S.col(col1) += S.col(col2) * std::pow(-1, rd());
  }
  Matrix<double, Dynamic, Dynamic> S_inv = stan::math::mdivide_right(I, S);
  Matrix<double, Dynamic, Dynamic> diag_elements(1, size);
  diag_elements.setRandom();

  // Compute matrix exponential (analytically and using function)
  stan::math::start_nested();
  matrix_v diag_elements_var = diag_elements.cast<var>();
  matrix_v A
      = S.cast<var>() * diag_elements_var.asDiagonal() * S_inv.cast<var>();
  matrix_v expm_A = stan::math::matrix_exp_pade(A);
  Matrix<double, Dynamic, Dynamic> exp_diag_elements
      = stan::math::exp(diag_elements);
  Matrix<double, Dynamic, Dynamic> exp_A
      = S * exp_diag_elements.asDiagonal() * S_inv;

  double rel_err = 1e-10
                   * std::max(exp_A.cwiseAbs().maxCoeff(),
                              expm_A.cwiseAbs().maxCoeff().val());

  // Test values
  for (int i = 0; i < size; i++)
    for (int j = 0; j < size; j++)
      EXPECT_NEAR(exp_A(i, j), expm_A(i, j).val(), rel_err);

  // Test adjoints
  for (int i = 0; i < size; i++) {
    for (int j = 0; j < size; j++) {
      if (i > 0 || j > 0)
        stan::math::set_zero_all_adjoints_nested();
      grad(expm_A(i, j).vi_);
      std::vector<double> g_abs(size);
      for (int k = 0; k < size; k++)
        g_abs[k] = std::abs(diag_elements_var(k).adj());
      Matrix<double, Dynamic, Dynamic> dA(size, size), dA_exp(size, size);
      for (int k = 0; k < size; k++) {
        dA.setZero();
        dA(k, k) = exp(diag_elements(k));
        dA_exp = S * dA * S_inv;
        rel_err = std::max(dA_exp.cwiseAbs().maxCoeff(), stan::math::max(g_abs))
                  * 1e-10;
        EXPECT_NEAR(dA_exp(i, j), diag_elements_var(k).adj(), rel_err);
      }
    }
  }
}
TEST(MathMatrix, matrix_exp_25x25_1) {
  do_test();  
}
TEST(MathMatrix, matrix_exp_25x25_2) {
  do_test();  
}
// .. and so on

1 of the 320 repeats of the same tests failed with this error message:

[ RUN      ] MathMatrix.matrix_exp_25x25_1_43
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.0948728146331632e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to 16.233583831312952,
diag_elements_var(k).adj() evaluates to 16.23358384226168, and
rel_err evaluates to 8.9284711072221241e-09.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.2407681992954167e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to -16.233583831312941,
diag_elements_var(k).adj() evaluates to -16.233583843720623, and
rel_err evaluates to 8.9284711072221241e-09.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.5544677545165086e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to 6.3130603788439634,
diag_elements_var(k).adj() evaluates to 6.3130603632992859, and
rel_err evaluates to 1.0064620200060062e-08.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.7232567373071106e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to 8.1167919156564761,
diag_elements_var(k).adj() evaluates to 8.1167919328890434, and
rel_err evaluates to 1.0838821758652955e-08.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 2.1192293253591288e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to -4.5093288420313948,
diag_elements_var(k).adj() evaluates to -4.5093288208391016, and
rel_err evaluates to 1.1613023307870846e-08.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.2901507417950597e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to -15.383280815786479,
diag_elements_var(k).adj() evaluates to -15.383280828687987, and
rel_err evaluates to 1.0838821759640349e-08.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 2.2139580835300876e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to -8.1167919156564707,
diag_elements_var(k).adj() evaluates to -8.1167919377960516, and
rel_err evaluates to 1.0838821759640349e-08.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.1298270763404616e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to -6.1854337194179561,
diag_elements_var(k).adj() evaluates to -6.1854337307162268, and
rel_err evaluates to 1.0838821759640349e-08.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.1101725760909176e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to -9.0186576840628945,
diag_elements_var(k).adj() evaluates to -9.0186576951646202, and
rel_err evaluates to 9.2904186493362664e-09.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.0286100859957514e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to -27.055973052187937,
diag_elements_var(k).adj() evaluates to -27.055973062474038, and
rel_err evaluates to 8.9284711072221241e-09.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.944448158042178e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to -27.055973052188389,
diag_elements_var(k).adj() evaluates to -27.055973032743907, and
rel_err evaluates to 1.5484031076695103e-08.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 3.2325161214430409e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to 40.583959578282347,
diag_elements_var(k).adj() evaluates to 40.583959610607508, and
rel_err evaluates to 2.1677643517422122e-08.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.0824820151356107e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to -31.565301894219814,
diag_elements_var(k).adj() evaluates to -31.565301905044635, and
rel_err evaluates to 1.0064620204045832e-08.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.2455306119818488e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to -27.055973052188389,
diag_elements_var(k).adj() evaluates to -27.055973064643695, and
rel_err evaluates to 8.9284711072221241e-09.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.5639372463738255e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to 40.583959578282347,
diag_elements_var(k).adj() evaluates to 40.583959562642974, and
rel_err evaluates to 1.0838821753938328e-08.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.598195176200079e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to -15.331718062906875,
diag_elements_var(k).adj() evaluates to -15.331718078888827, and
rel_err evaluates to 8.9284711072221241e-09.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 7.5546000566362181e-09, which exceeds rel_err, where
dA_exp(i, j) evaluates to -3.8064207504112102,
diag_elements_var(k).adj() evaluates to -3.8064207579658103, and
rel_err evaluates to 6.8515573507398604e-09.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.2318207787131996e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to 7.6658590314533628,
diag_elements_var(k).adj() evaluates to 7.665859019135155, and
rel_err evaluates to 9.2904186459849822e-09.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 2.7143023828557489e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to -15.331718062906923,
diag_elements_var(k).adj() evaluates to -15.331718090049947, and
rel_err evaluates to 1.3935627976052571e-08.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.6921646306400362e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to -45.995154188719496,
diag_elements_var(k).adj() evaluates to -45.995154205641143, and
rel_err evaluates to 9.2904186493889942e-09.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 6.0598040363402106e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to -68.992731283080047,
diag_elements_var(k).adj() evaluates to -68.992731343678088, and
rel_err evaluates to 3.2516465277888346e-08.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.041806285684288e-07, which exceeds rel_err, where
dA_exp(i, j) evaluates to 325.16465267470284,
diag_elements_var(k).adj() evaluates to 325.16465277888346, and
rel_err evaluates to 7.5678201902266853e-08.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 4.0912667031989258e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to -45.995154188720264,
diag_elements_var(k).adj() evaluates to -45.995154229632931, and
rel_err evaluates to 2.3226046626705967e-08.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.0202370503975544e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to 12.175187873484703,
diag_elements_var(k).adj() evaluates to 12.175187883687073, and
rel_err evaluates to 9.8710698147014681e-09.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.2195554788263507e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to -12.175187873484715,
diag_elements_var(k).adj() evaluates to -12.17518786128916, and
rel_err evaluates to 8.9284711072221241e-09.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.0285599927328803e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to -8.1167919156565169,
diag_elements_var(k).adj() evaluates to -8.116791905370917, and
rel_err evaluates to 8.9284711072221241e-09.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.1459227344801093e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to 6.7639932630470918,
diag_elements_var(k).adj() evaluates to 6.7639932745063192, and
rel_err evaluates to 8.9284711072221241e-09.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 2.3146114358496561e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to 10.822389220875394,
diag_elements_var(k).adj() evaluates to 10.822389244021508, and
rel_err evaluates to 1.7032434191861717e-08.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 3.3876009553068798e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to -27.055973052188389,
diag_elements_var(k).adj() evaluates to -27.055973086064398, and
rel_err evaluates to 1.5484031084777054e-08.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 3.0645779247606697e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to 22.54664421015697,
diag_elements_var(k).adj() evaluates to 22.54664417951119, and
rel_err evaluates to 2.3226046614067266e-08.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.7586778255918034e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to -36.525563620454143,
diag_elements_var(k).adj() evaluates to -36.525563638040921, and
rel_err evaluates to 8.9284711072221241e-09.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 9.6794146031697892e-09, which exceeds rel_err, where
dA_exp(i, j) evaluates to -6.1854337194179685,
diag_elements_var(k).adj() evaluates to -6.1854337290973831, and
rel_err evaluates to 8.1291163199766469e-09.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.0768207658884421e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to 20.291979789141276,
diag_elements_var(k).adj() evaluates to 20.291979799909484, and
rel_err evaluates to 8.9284711072221241e-09.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.228774948458522e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to 36.525563620454115,
diag_elements_var(k).adj() evaluates to 36.525563632741864, and
rel_err evaluates to 8.9284711072221241e-09.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.1315322900884439e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to 4.058395957828238,
diag_elements_var(k).adj() evaluates to 4.0583959691435609, and
rel_err evaluates to 1.0838821757946313e-08.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.0362007252240346e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to -1.3527986526094304,
diag_elements_var(k).adj() evaluates to -1.3527986629714377, and
rel_err evaluates to 8.9284711072221241e-09.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.202325661253667e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to -2.2546644210156974,
diag_elements_var(k).adj() evaluates to -2.254664433038954, and
rel_err evaluates to 1.1613023311380983e-08.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.1744493377818799e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to -4.0583959578282354,
diag_elements_var(k).adj() evaluates to -4.0583959695727287, and
rel_err evaluates to 1.0838821758194707e-08.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.0219626034313478e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to 25.252241515375854,
diag_elements_var(k).adj() evaluates to 25.25224152559548, and
rel_err evaluates to 1.006462020331628e-08.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.1292748069990921e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to 32.467167662625904,
diag_elements_var(k).adj() evaluates to 32.467167673918652, and
rel_err evaluates to 1.0838821756659423e-08.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.1999560456388281e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to -32.467167662625883,
diag_elements_var(k).adj() evaluates to -32.467167674625443, and
rel_err evaluates to 1.0838821757270261e-08.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.5601685277033539e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to -10.822389220875394,
diag_elements_var(k).adj() evaluates to -10.822389236477079, and
rel_err evaluates to 1.490337991760937e-08.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 9.6624790391075521e-09, which exceeds rel_err, where
dA_exp(i, j) evaluates to 1.8037315368125559,
diag_elements_var(k).adj() evaluates to 1.803731546475035, and
rel_err evaluates to 8.9284711072221241e-09.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.5050801493998733e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to 21.644778441750788,
diag_elements_var(k).adj() evaluates to 21.644778426699986, and
rel_err evaluates to 1.490337991326735e-08.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.2504028035209558e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to 21.644778441750351,
diag_elements_var(k).adj() evaluates to 21.644778454254379, and
rel_err evaluates to 8.9284711072221241e-09.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 2.114898478566829e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to -30.766561631572763,
diag_elements_var(k).adj() evaluates to -30.766561652721748, and
rel_err evaluates to 2.0322790798395047e-08.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 2.6739538583342437e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to -18.037315368125579,
diag_elements_var(k).adj() evaluates to -18.037315394865118, and
rel_err evaluates to 2.0322790798395047e-08.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 2.0865368099975967e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to 15.782650947109882,
diag_elements_var(k).adj() evaluates to 15.782650926244514, and
rel_err evaluates to 1.1613023306710136e-08.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.016763917505159e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to 19.84104690493831,
diag_elements_var(k).adj() evaluates to 19.841046915105949, and
rel_err evaluates to 8.9284711072221241e-09.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.1298688207261876e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to -16.665220883768363,
diag_elements_var(k).adj() evaluates to -16.665220895067051, and
rel_err evaluates to 9.9991325302611487e-09.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.2936393351791698e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to -1.7402109814158124e-13,
diag_elements_var(k).adj() evaluates to -1.293656737288984e-08, and
rel_err evaluates to 8.9284711072221241e-09.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 9.5133412258974204e-09, which exceeds rel_err, where
dA_exp(i, j) evaluates to -8.5644466884246828,
diag_elements_var(k).adj() evaluates to -8.564446697938024, and
rel_err evaluates to 8.9033178742021168e-09.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 4.9536247104242648e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to 41.663052209421998,
diag_elements_var(k).adj() evaluates to 41.663052159885751, and
rel_err evaluates to 4.8968248277391013e-08.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 5.8023623239478184e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to 59.523140714814666,
diag_elements_var(k).adj() evaluates to 59.523140656791043, and
rel_err evaluates to 4.8968248277391013e-08.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.2311329555814154e-07, which exceeds rel_err, where
dA_exp(i, j) evaluates to -489.68248289702342,
diag_elements_var(k).adj() evaluates to -489.68248277391012, and
rel_err evaluates to 7.5678201902266853e-08.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.561290829954487e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to 16.665220883768267,
diag_elements_var(k).adj() evaluates to 16.665220868155359, and
rel_err evaluates to 9.9991325302611487e-09.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 3.3021670731159247e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to -59.523140714813543,
diag_elements_var(k).adj() evaluates to -59.523140747835214, and
rel_err evaluates to 8.9284711072221241e-09.
....
[  FAILED  ] MathMatrix.matrix_exp_25x25_1_43 (1464 ms)

On the second run of these 320 tests, a different error message:

[ RUN      ] MathMatrix.matrix_exp_25x25_3_14
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.1636963392902544e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to 55.469370008224381,
diag_elements_var(k).adj() evaluates to 55.469370019861344, and
rel_err evaluates to 1.081668887919168e-08.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 2.0092898012080695e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to 95.090348585527522,
diag_elements_var(k).adj() evaluates to 95.09034860562042, and
rel_err evaluates to 1.9470039982888374e-08.
test/unit/math/rev/mat/fun/matrix_exp_pade_test.cpp:158: Failure
The difference between dA_exp(i, j) and diag_elements_var(k).adj() is 1.9812773643934634e-08, which exceeds rel_err, where
dA_exp(i, j) evaluates to -95.090348585527522,
diag_elements_var(k).adj() evaluates to -95.090348605340296, and
rel_err evaluates to 1.4061695543450561e-08.
[  FAILED  ] MathMatrix.matrix_exp_25x25_3_14 (1505 ms)
 

Example

To repeat run this test a few times (it will probably fail in the first run):
https://gist.github.com/rok-cesnovar/0ea7a3e82737580a07a4153b73a5460a

Expected Output

This should not fail.

Current Version:

v2.19.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions