Boost C++ Libraries: Ticket #6934: quantile() on an inverse_gaussian_distribution<RealType, Policy> object does not compile https://svn.boost.org/trac10/ticket/6934 <p> <code>quantile()</code> creates an object of type <code>inverse_gaussian_quantile_functor&lt;RealType&gt;</code>, the constructor of which expects an argument of type <code>inverse_gaussian_distribution&lt;RealType, policies::policy&lt;&gt; &gt;</code>. Therefore, <code>quantile()</code> cannot be used with a custom policy, because <code>inverse_gaussian_distribution&lt;RealType, Policy&gt;</code> cannot usually be cast to <code>inverse_gaussian_distribution&lt;RealType, policies::policy&lt;&gt; &gt;</code>. </p> <p> Example: </p> <pre class="wiki">#include &lt;boost/math/distributions/inverse_gaussian.hpp&gt; using namespace boost::math; using namespace boost::math::policies; typedef policy&lt; domain_error&lt;errno_on_error&gt; &gt; my_policy; int main() { quantile(inverse_gaussian_distribution&lt;double, my_policy&gt;(), .5); } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6934 Trac 1.4.3 John Maddock Wed, 23 May 2012 16:16:24 GMT status changed; cc set https://svn.boost.org/trac10/ticket/6934#comment:1 https://svn.boost.org/trac10/ticket/6934#comment:1 <ul> <li><strong>cc</strong> <span class="trac-author">pbristow@…</span> added </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> <p> Confirmed. </p> <p> Not sure how this slipped through our concept checks.... will investigate. </p> <p> Paul did you write this one? If so can I let you fix? </p> Ticket John Maddock Wed, 23 May 2012 16:53:48 GMT <link>https://svn.boost.org/trac10/ticket/6934#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6934#comment:2</guid> <description> <p> The following patch updates our tests to show the error: </p> <pre class="wiki">Index: distribution_concept_check.cpp =================================================================== --- distribution_concept_check.cpp (revision 78472) +++ distribution_concept_check.cpp (working copy) @@ -16,26 +16,28 @@ using namespace boost::math; using namespace boost::math::concepts; - function_requires&lt;DistributionConcept&lt;normal_distribution&lt;RealType&gt; &gt; &gt;(); - function_requires&lt;DistributionConcept&lt;beta_distribution&lt;RealType&gt; &gt; &gt;(); - function_requires&lt;DistributionConcept&lt;binomial_distribution&lt;RealType&gt; &gt; &gt;(); - function_requires&lt;DistributionConcept&lt;cauchy_distribution&lt;RealType&gt; &gt; &gt;(); - function_requires&lt;DistributionConcept&lt;bernoulli_distribution&lt;RealType&gt; &gt; &gt;(); - function_requires&lt;DistributionConcept&lt;chi_squared_distribution&lt;RealType&gt; &gt; &gt;(); - function_requires&lt;DistributionConcept&lt;exponential_distribution&lt;RealType&gt; &gt; &gt;(); - function_requires&lt;DistributionConcept&lt;extreme_value_distribution&lt;RealType&gt; &gt; &gt;(); - function_requires&lt;DistributionConcept&lt;fisher_f_distribution&lt;RealType&gt; &gt; &gt;(); - function_requires&lt;DistributionConcept&lt;gamma_distribution&lt;RealType&gt; &gt; &gt;(); - function_requires&lt;DistributionConcept&lt;students_t_distribution&lt;RealType&gt; &gt; &gt;(); - function_requires&lt;DistributionConcept&lt;pareto_distribution&lt;RealType&gt; &gt; &gt;(); - function_requires&lt;DistributionConcept&lt;poisson_distribution&lt;RealType&gt; &gt; &gt;(); - function_requires&lt;DistributionConcept&lt;rayleigh_distribution&lt;RealType&gt; &gt; &gt;(); - function_requires&lt;DistributionConcept&lt;weibull_distribution&lt;RealType&gt; &gt; &gt;(); - function_requires&lt;DistributionConcept&lt;lognormal_distribution&lt;RealType&gt; &gt; &gt;(); - function_requires&lt;DistributionConcept&lt;triangular_distribution&lt;RealType&gt; &gt; &gt;(); - function_requires&lt;DistributionConcept&lt;uniform_distribution&lt;RealType&gt; &gt; &gt;(); - function_requires&lt;DistributionConcept&lt;negative_binomial_distribution&lt;RealType&gt; &gt; &gt;(); - function_requires&lt;DistributionConcept&lt;non_central_chi_squared_distribution&lt;RealType&gt; &gt; &gt;(); + typedef policies::policy&lt;policies::digits2&lt;std::numeric_limits&lt;RealType&gt;::digits - 2&gt; &gt; custom_policy; + + function_requires&lt;DistributionConcept&lt;normal_distribution&lt;RealType, custom_policy&gt; &gt; &gt;(); + function_requires&lt;DistributionConcept&lt;beta_distribution&lt;RealType, custom_policy&gt; &gt; &gt;(); + function_requires&lt;DistributionConcept&lt;binomial_distribution&lt;RealType, custom_policy&gt; &gt; &gt;(); + function_requires&lt;DistributionConcept&lt;cauchy_distribution&lt;RealType, custom_policy&gt; &gt; &gt;(); + function_requires&lt;DistributionConcept&lt;bernoulli_distribution&lt;RealType, custom_policy&gt; &gt; &gt;(); + function_requires&lt;DistributionConcept&lt;chi_squared_distribution&lt;RealType, custom_policy&gt; &gt; &gt;(); + function_requires&lt;DistributionConcept&lt;exponential_distribution&lt;RealType, custom_policy&gt; &gt; &gt;(); + function_requires&lt;DistributionConcept&lt;extreme_value_distribution&lt;RealType, custom_policy&gt; &gt; &gt;(); + function_requires&lt;DistributionConcept&lt;fisher_f_distribution&lt;RealType, custom_policy&gt; &gt; &gt;(); + function_requires&lt;DistributionConcept&lt;gamma_distribution&lt;RealType, custom_policy&gt; &gt; &gt;(); + function_requires&lt;DistributionConcept&lt;students_t_distribution&lt;RealType, custom_policy&gt; &gt; &gt;(); + function_requires&lt;DistributionConcept&lt;pareto_distribution&lt;RealType, custom_policy&gt; &gt; &gt;(); + function_requires&lt;DistributionConcept&lt;poisson_distribution&lt;RealType, custom_policy&gt; &gt; &gt;(); + function_requires&lt;DistributionConcept&lt;rayleigh_distribution&lt;RealType, custom_policy&gt; &gt; &gt;(); + function_requires&lt;DistributionConcept&lt;weibull_distribution&lt;RealType, custom_policy&gt; &gt; &gt;(); + function_requires&lt;DistributionConcept&lt;lognormal_distribution&lt;RealType, custom_policy&gt; &gt; &gt;(); + function_requires&lt;DistributionConcept&lt;triangular_distribution&lt;RealType, custom_policy&gt; &gt; &gt;(); + function_requires&lt;DistributionConcept&lt;uniform_distribution&lt;RealType, custom_policy&gt; &gt; &gt;(); + function_requires&lt;DistributionConcept&lt;negative_binomial_distribution&lt;RealType, custom_policy&gt; &gt; &gt;(); + function_requires&lt;DistributionConcept&lt;non_central_chi_squared_distribution&lt;RealType, custom_policy&gt; &gt; &gt;(); } Index: instantiate.hpp =================================================================== --- instantiate.hpp (revision 78527) +++ instantiate.hpp (working copy) @@ -18,7 +18,7 @@ #ifndef BOOST_MATH_INSTANTIATE_MINIMUM -typedef boost::math::policies::policy&lt;&gt; test_policy; +typedef boost::math::policies::policy&lt;boost::math::policies::promote_float&lt;false&gt;, boost::math::policies::promote_double&lt;false&gt; &gt; test_policy; namespace test{ </pre><p> Then try and compile either std_real_concept_check.cpp or test_instantiate1.cpp. Thankfully the inverse_gaussian distro is the only thing that fails. </p> <p> I haven't committed the above patch, because it'll break the regression tests at present. </p> <p> John. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Paul A. Bristow</dc:creator> <pubDate>Thu, 24 May 2012 11:18:36 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6934#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6934#comment:3</guid> <description> <p> Thanks for this report. Added template parameter Policy to two functors and test program provided now compiles and runs. </p> <p> Command: Commit Modified: I:\boost-trunk\boost\math\distributions\inverse_gaussian.hpp Sending content: I:\boost-trunk\boost\math\distributions\inverse_gaussian.hpp Completed: At revision: 78579 </p> <p> (This might not make 1.50 because John Maddock is away. Sorry :-(. </p> <p> (Also need commit of patch above to confirm meets the full cncept check). </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Paul A. Bristow</dc:creator> <pubDate>Thu, 24 May 2012 11:19:35 GMT</pubDate> <title>status, version, milestone changed; resolution set https://svn.boost.org/trac10/ticket/6934#comment:4 https://svn.boost.org/trac10/ticket/6934#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>version</strong> <span class="trac-field-old">Boost 1.49.0</span> → <span class="trac-field-new">Boost 1.50.0</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.50.0</span> </li> </ul> Ticket John Maddock Mon, 28 May 2012 11:05:46 GMT <link>https://svn.boost.org/trac10/ticket/6934#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6934#comment:5</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/78711" title="Update concept checks to unmask issues reported in #6934. Add some ...">[78711]</a>) Update concept checks to unmask issues reported in <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6934" title="#6934: Bugs: quantile() on an inverse_gaussian_distribution&lt;RealType, Policy&gt; ... (closed: fixed)">#6934</a>. Add some distributions to the concept tests that were missing before. Add skew_normal_distribution to distributions.hpp. Fix some errors in calculating custom policies when the defaults have been changed. Fix the errors and warnings that result from the above. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6934" title="#6934: Bugs: quantile() on an inverse_gaussian_distribution&lt;RealType, Policy&gt; ... (closed: fixed)">#6934</a>. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Wed, 30 May 2012 16:52:22 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6934#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6934#comment:6</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/78771" title="Update to use new out-of-bounds error checking. Refs #6934.">[78771]</a>) Update to use new out-of-bounds error checking. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6934" title="#6934: Bugs: quantile() on an inverse_gaussian_distribution&lt;RealType, Policy&gt; ... (closed: fixed)">#6934</a>. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Wed, 30 May 2012 18:15:45 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6934#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6934#comment:7</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/78773" title="Add extra error tests for negative_binomial to laplace distros. Refs #6934.">[78773]</a>) Add extra error tests for negative_binomial to laplace distros. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6934" title="#6934: Bugs: quantile() on an inverse_gaussian_distribution&lt;RealType, Policy&gt; ... (closed: fixed)">#6934</a>. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Thu, 31 May 2012 10:18:05 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6934#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6934#comment:8</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/78778" title="Update more distribution tests, from Inverse* down to gamma. Refs #6934.">[78778]</a>) Update more distribution tests, from Inverse* down to gamma. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6934" title="#6934: Bugs: quantile() on an inverse_gaussian_distribution&lt;RealType, Policy&gt; ... (closed: fixed)">#6934</a>. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Thu, 31 May 2012 11:15:45 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6934#comment:9 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6934#comment:9</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/78783" title="Update more distribution tests for fisher_f and extreme_value and fix ...">[78783]</a>) Update more distribution tests for fisher_f and extreme_value and fix failures. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6934" title="#6934: Bugs: quantile() on an inverse_gaussian_distribution&lt;RealType, Policy&gt; ... (closed: fixed)">#6934</a>. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Thu, 31 May 2012 11:58:09 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6934#comment:10 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6934#comment:10</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/78784" title="Enhance exponential_distribution tests. Refs #6934.">[78784]</a>) Enhance exponential_distribution tests. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6934" title="#6934: Bugs: quantile() on an inverse_gaussian_distribution&lt;RealType, Policy&gt; ... (closed: fixed)">#6934</a>. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Thu, 02 Aug 2012 11:57:11 GMT</pubDate> <title>milestone changed https://svn.boost.org/trac10/ticket/6934#comment:11 https://svn.boost.org/trac10/ticket/6934#comment:11 <ul> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.50.0</span> → <span class="trac-field-new">Boost 1.52.0</span> </li> </ul> Ticket